String concatenation
Leif B. Kristensen
junkmail at solumslekt.org
Fri Apr 2 04:24:04 EST 2004
Paul Rubin wrote:
> "Leif B. Kristensen" <junkmail at solumslekt.org> writes:
>> for i in range(5):
>> tmp = res[i]
>> if tmp[:1] != '-' and len(tmp) != 0:
>> place = place + ', ' + (res[i])
>> return place[2:]
>
> tmp = [x for x in res if x and x[0] != '-']
> return ', '.join(tmp)
Now I got it working, and it's really neat! It's almost incredible that
you can do all this with just two lines of code.
Thank you very much.
regards,
--
Leif Biberg Kristensen
http://solumslekt.org/
Validare necesse est
More information about the Python-list
mailing list