Skip to content

Instantly share code, notes, and snippets.

@joncle
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joncle/9599d6903427e29b2387 to your computer and use it in GitHub Desktop.
Save joncle/9599d6903427e29b2387 to your computer and use it in GitHub Desktop.
from itertools import tee
i = iter(range(100))
firstline = next(i, '')
fst, snd = tee(i)
next(snd, '')
for line in (fst for fst, snd in zip(fst, snd) if snd):
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment