我正在尝试比较两个.txt文件,并找出两者中的每个常用词(忽略大小写。如果有人可以将我指向正确的方向,这会有所帮助。(我没有任何python编写经验,只是编辑一些脚本)
This will give you list containing common words from two files. Output format is list.
with open('a','r') as f, open('b','r') as g:
l=f.readlines()
l1=g.readlines()
print list(set(l)&set(l1))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.