I have a file named test.txt that contains the following:
test.txt
Line 1 Line 2 Line 3 Line 4
I have simple Python program like this:<
Strip the newline character:
for line in f: print myline + " - " + line if myline == line.strip(): print "We have a match!"