formatting list -> comma separated

Robert rw.segaar at xs4all.nl
Wed Jul 9 15:23:20 EDT 2008


given d:

d = ["soep", "reeds", "ook"]

I want it to print like

soep, reeds, ook

I've come up with :

print ("%s"+", %s"*(len(d)-1)) % tuple(d)

but this fails for d = []

any (pythonic) options for this?

Robert






More information about the Python-list mailing list