map() question...

Sean 'Shaleh' Perry shalehperry at attbi.com
Mon Jan 13 03:37:40 CET 2003


On Sunday 12 January 2003 18:24, Mike Meyer wrote:
> "Kevin Ethridge" <kevinethridge at yahoo.com> writes:
> > Why doesn't map() work with the print function?
> > ie map(print, ['Have', 'a', 'great', 'day.'])
>
> Because print isn't a function, it's a statement. It will work with
> sys.stdout.write.
>
>         <mike

but sys.stdout.write does not output a newline automatically you need to add a 
\n to the string.  So you end up using a lambda either way.





More information about the Python-list mailing list