def nonre_word(*lst):
word_d = {}
for word in lst:
if word in word_d:
word_d[word] += 1
else:
word_d[word] = 1
print([k for k, v in word_d.items() if v == 1])
#调用函数
linkeng = ['you', 'you', 'me', 'are', 'me']
nonre_word(*linkeng)
python大学实用教程练习5.7.1(统计不重复单词)
最新推荐文章于 2023-11-29 23:56:08 发布