What I am trying to do is compare two files to each other.
If the 2nd file contains the same line the first file contains, I want
to print it. I wrote up the following code:
correct_setting s = open("C:\Python 25\Scripts\Outp ut
\correct_settin gs.txt","r")
current_setting s = open("C:\Python 25\Scripts\Outp ut\output.txt", "r")
for line in correct_setting s:
for val in current_setting s:
if val == line:
print line + " found."
correct_setting s.close()
current_setting s.close()
For some reason this only looks at the first line of the
correct_setting s.txt file. Any ideas as to how i can loop through each
line of the correct_setting s file instead of just looking at the first?
If the 2nd file contains the same line the first file contains, I want
to print it. I wrote up the following code:
correct_setting s = open("C:\Python 25\Scripts\Outp ut
\correct_settin gs.txt","r")
current_setting s = open("C:\Python 25\Scripts\Outp ut\output.txt", "r")
for line in correct_setting s:
for val in current_setting s:
if val == line:
print line + " found."
correct_setting s.close()
current_setting s.close()
For some reason this only looks at the first line of the
correct_setting s.txt file. Any ideas as to how i can loop through each
line of the correct_setting s file instead of just looking at the first?
Comment