Skip to content

Instantly share code, notes, and snippets.

@zenloner
Created April 10, 2013 03:33
Show Gist options
  • Save zenloner/5351580 to your computer and use it in GitHub Desktop.
Save zenloner/5351580 to your computer and use it in GitHub Desktop.
print something in a lambda
import sys
#use sys.stdout.write(x) to print x in a lambda
showall = (lambda x: map(sys.stdout.write, x))
# showall = lambda x:[sys.stdout.write(line) for line in x]
t = showall(['a\n', 'b\n', 'c\n']) # it will print a\nb\nc\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment