Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import izip_longest
- from contextlib import nested
- names = ('file1', 'file2')
- with nested(*map(open, names)) as files:
- for line in (line for pair in izip_longest(*files)
- for line in pair if line):
- print line.strip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement