find = open("words.txt")
def noE():
for line in find:
if line.find("e") == -1:
word = line.strip()
print word,
noE()
上面的代码在 .txt 文件中搜索所有不包含字母“e”的单词,然后打印出来。如果有条件,我希望能够在此条件下计算总字数。我查看了 python 文档并找到了 Count() 但导入对我不起作用(假设我做错了什么)。任何帮助将非常感激!