fileread_practice.py 463 Bytes
f1 = open("C:\\Users\\menu_recommand_webpage\\ect.txt", "r", encoding="utf-8")
f2 = open("C:\\Users\\menu_recommand_webpage\\water.txt", "r", encoding="utf-8")

list_compare = list()

list1 = []
for i in list(f1):
    list1.append(i)

list2 = []
for i in list(f2):
    list2.append(i)

for i in list1:
    if i in list2:
        list_compare.append(i)

list_compare_fixed = [item.strip() for item in list_compare]
print(list_compare_fixed)

f1.close()
f2.close()