mapping None values to ''

Scott David Daniels scott.daniels at acm.org
Sun Jun 18 19:41:17 EDT 2006


Roberto Bonvallet wrote:
> imho <certo at comeno.it>:
>> map(lambda x:"" , [i for i in [a,b,c] if i in ("None",None) ])
> You don't need map when using list comprehensions:
>    ["" for i in [a, b, c] if i in ("None", None)]
> 
More like:

     [(i, "")[i in ("None", None)] for i in [a,b,c]]

-- 
--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list