遍历字符串使用切片方式定位字符
摘要:
语法: for i in range(len(string): string[i:i+len(word)]解析:i取字符串下标,并且会向后移动,string去当前i值到定位字符长度位置的字符元素示例:判断字符个数 # def count_word2(string,word):# times = 0# 阅读全文
posted @ 2020-06-20 09:23 开发小学生 阅读(245) 评论(0) 推荐(0)
浙公网安备 33010602011771号