Currently, this code is giving me all lines from searchfile
once. But with my newbie understanding, it should print out all lines from searchfile
for every infile
line!
searchfile = open('.\sometext.txt', 'r')
infile = open('.\somefile', 'r')
for line1 in infile:
for line2 in searchfile:
print line2
searchfile.close()
infile.close()
I tried to use searchfile.readlines()
to create a list to print all infile
lines for all searchfile
lines, but it still does not work. Does anyone have a clue?