Depricated String Functions in Python

Simon Forman rogue_pedro at yahoo.com
Thu Jul 20 09:30:40 EDT 2006


Anoop wrote:
> Thanks Stefen
>
> let me be more specific how would i have to write the following
> function in the deprecated format
>
> map(string.lower,list)
>
> Thanks Anoop

Ah.  This is easy enough:

lower_list = [s.lower() for s in str_list]

Or, if you really like map() (or really don't like list comprehensions
;P ) you could use this:

lower_list = map(lambda s : s.lower(), str_list)


Hope this helps,
~Simon




More information about the Python-list mailing list