import string
fin = open(filename)
words = []
count = 0
for line in fin:
line = line.replace('-',' ')
for word in line.split():
word = word.strip(string.punctuation + string.whitespace)
word = word.lower()
if word not in words:
words.append(word)
count = count+1
print count , ' ' , word
如何提取一篇英文文章的所有单词
最新推荐文章于 2023-04-12 12:06:29 发布