Skip to content

Instantly share code, notes, and snippets.

@jorendorff
Created February 10, 2014 17:59
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 jorendorff/8920940 to your computer and use it in GitHub Desktop.
Save jorendorff/8920940 to your computer and use it in GitHub Desktop.
for line in (line for line in (line.strip() for line in res.out.split('\n')) if line):
...
for line in filter(bool, (line.strip() for line in res.out.split('\n'))):
...
for line in filter(bool, map(lambda ln: ln.strip(), res.out.split('\n'))):
...
for line in res.out.splitlines():
line = line.strip()
if line:
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment