file1 = 'C:\\Users\\Administrator\\Desktop\\test\\ALL.txt' file2 = 'C:\\Users\\Administrator\\Desktop\\test\\little.txt' ALLlist = [] Demondlist = [] with open(file1, "r") as f1: text1 = f1.read() with open(file2, "r") as f2: text2 = f2.read() ALLlist.extend(text1.split()) Demondlist.extend(text2.split()) #print(demond) for i in ALLlist: for j in Demondlist: if j in i: print(i)
python 双循环遍历list 变量判断
最新推荐文章于 2022-08-18 16:35:06 发布