[Tutor] newbie map help

alan.gauld@bt.com alan.gauld@bt.com
Mon, 19 Nov 2001 17:08:50 -0000


> import string
> map(string.split, lines) ==> This s'd return me a list of lists.
> How do i specify the separator character to the split function in map?

map(lambda L, S=',':string.split(L,S), lines)


Should do it.
You use the default argument S=',' to make comma the separator.
Then the lambda returns the result when L is passed by map() to
the lambda at execution.

Alan g