Is there a commas-in-between idiom?

Christian Joergensen mail at razor.dk
Sun Nov 5 08:03:21 EST 2006


Ernesto García García <titogarcia_nospamplease_ at gmail.com> writes:

> Hi experts,
>
> it's very common that I have a list and I want to print it with commas
> in between. How do I do this in an easy manner, whithout having the
> annoying comma in the end?

>>> list = [1,2,3,4,5,6]
>>> print ','.join(map(str, list))
1,2,3,4,5,6

-- 
Christian Joergensen | Linux, programming or web consultancy
http://www.razor.dk  |     Visit us at: http://www.gmta.info



More information about the Python-list mailing list