import sys
showall = lambda x : list(map(sys.stdout.write,x))
t = showall(['spam\n','SPAM\n','Spam\n'])
print(t)
output
spam
SPAM
Spam
[5, 5, 5]
Why does the print statement output [5,5,5]?
thanks
import sys
showall = lambda x : list(map(sys.stdout.write,x))
t = showall(['spam\n','SPAM\n','Spam\n'])
print(t)
output
spam
SPAM
Spam
[5, 5, 5]
Why does the print statement output [5,5,5]?
thanks
Because sys.stdout.write
returns the number of bytes it wrote?