I have a list of strings and wanted to output them as a single delimited 
string.

Eg

('ab','cd','ef') becomes "ab:cd:ef"

My first attempt was to do it as a function:

def Addsomething(a):
        y = []
        for x in a:
                y.append( x + ':')
        return "".join(y)

I then converted the this to a lambda function and mapped it.

"".join(map((lambda x: x + ":"),L))



And this works just fine

BUT

This somehow seems a little incongruous for Python and wondered if there 
was a simpler, more stylish way of achieving this.

Are there any suggestions or is my solution good enough?

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to