list to string

Daniel Klein danielk at
Tue Feb 27 15:54:52 CET 2001

On Tue, 27 Feb 2001 07:22:03 GMT, Sheila King <sheila at> wrote:

>:>>> lst =["d", "o", "g"]
>:>>> lst
>:['d', 'o', 'g']
>:>>> dog = lst[0]+lst[1]+lst[2]
>:>>> dog
>:or is there something I'm not getting?
>Your method would be awfully tedious for very long strings. You want something
>that will be easy to implement, regardless of the length of the string.
>Fortunately, several others in this thread have already suggested using the
>join command from the string methods.

I just _know_ I'm going to get winged for this one but why not

mylist = ['d','o','g']
mystring = ''
for element in mylist:
      mystring = mystring + element

It's simple and intuitive. I know that it has to build a _new_ string each time
but for shorter strings...


More information about the Python-list mailing list