Created
April 10, 2013 03:33
-
-
Save zenloner/5351580 to your computer and use it in GitHub Desktop.
print something in a lambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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