'''查找文件中某个字符串总共出现的次数''' def findStr(str): with open("filePath",'r') as f: counts = 0 for line in f.readlines(): time = line.count(str) counts += time print("%s出现的次数:%d"%(str,counts))
findStr("str")
posted on
2020-12-01 18:41小白在此
阅读(6107)
评论(0)
编辑收藏举报