I want to read huge text file line by line (and stop if a line with \"str\" found). How to check, if file-end is reached?
fn = \'t.log\' f = open(fn, \'r\')
You can stop the 2-line separation in the output by using
with open('t.ini') as f: for line in f: print line.strip() if 'str' in line: break