String concatenation

Leif B. Kristensen junkmail at solumslekt.org
Sat Apr 3 04:22:47 EST 2004


Paul Rubin wrote:

>   tmp = [x for x in res if x and x[0] != '-']
>   return ', '.join(tmp)

Substituting tmp with the real thing, it turns into a one-liner:

return ', '.join([x for x in res if x and x[0] != '-'])

Awesome :-)
-- 
Leif Biberg Kristensen
http://solumslekt.org/
Validare necesse est



More information about the Python-list mailing list