I am trying to make a pogram which can check two files and then return the same things in those two files, I tried to test on numbers but there is a problem which i am facing
Here,s the code:
""" This program will find the overlapping numbers b/w two text files"""
From = input("Enter the File you wanna check from = ").lower()
to = input("Enter the File you wanna check to = ").lower()
def check():
rfrom = open(From, "r")
rto = open(to, "r")
lin1 = rfrom.read()
lin2 = rto.read()
for common in lin1:
if common in lin2 and lin1:
print(common)
check()
In the for i am tryinf to make it check the same numbers b/w two files but instead of iterating through a complete number like 56 it iterates like first 5 and then 6 which causes the problem , please help me in this so the for loop can understand that i have to iterate through a whole number... Not just one by one
What I have tried:
I treid to put commas and tried to convert the lin1 and lin2 at for in lists.I tried to make the 2 files in .py extension but that also didn,t worked