统计英文文本中出现的不同单词个数:读取只包含英文和标点的文件/data/abc.txt,文件中单词与单词之间用1个空格或标点符号隔开,文末以标点符号结尾,区分单词大小写,输出该文本中所出现的不同单词个数。
请在以下Python程序的划线处填入合适的代码:
f = open('/data/__①__', 'r')
text = f.read()
lst = []
s = ""
def judge(__②__):
if st in lst:
return False
else:
return True
for i in range(len(text)):
c = __③__
if "a" <= c <= "z" or "A" <= c <= "Z":
s = s + c
else:
if judge(s):
lst.append(s)
s = ""
print("出现的不同单词个数为:", len(lst))