#coding:gbk filename = 'pg58251.txt' with open(filename) as obj: line = obj.read()#不是为了赋值而赋值,是为了read()而赋值 print(line.count('the'))#count() 是查询使用了多少个 the print(line.lower().count('the'))#查询之前.lower()是转化为小写之后再比对 #以上文本文件来自 Gutenberg 无版权读物网站
最后修改:2022 年 12 月 05 日
© 允许规范转载