What would be your preferred way to concatenate strings from a sequence such that between every two consecutive pairs a comma is added. That is, how do you map, for instance, ['a', 'b', 'c']
to 'a,b,c'
? (The cases ['s']
and []
should be mapped to 's'
and ''
, respectively.)
I usually end up using something like ''.join(map(lambda x: x+',',l))[:-1]
, but also feeling somewhat unsatisfied.