Join strings - very simple Q.

Paul Rudin paul.rudin at ntlworld.com
Fri Mar 23 20:08:53 CET 2007


Paul Rudin <paul.rudin at ntlworld.com> writes:

> Paulo da Silva <psdasilvaX at esotericaX.ptX> writes:
>
>> Hi!
>>
>> I was told in this NG that string is obsolet. I should use
>> str methods.
>>
>> So, how do I join a list of strings delimited by a given
>> char, let's say ','?
>>
>> Old way:
>>
>> l=['a','b','c']
>> jl=string.join(l,',')
>>
>> New way?
>
> Dunno if it's the "new way", but you can do: ''.join(l)

Err, sorry - missed the comma out - it should be: ','.join(l)



More information about the Python-list mailing list