Is there a better way to read lines two at a time from a file in python than:
with open(fn) as f: for line in f: try: line2 = f.next(
You could possibly make it more clear with a generator:
def read2(f): for line in f: try: line2 = f.next() except StopIteration: line2 = '' yield line, line2 with open(fn) as f: for line1, line2 in read2(f): print line1 print line2