list to string

Jeremy Hylton jeremy at
Tue Feb 27 03:58:58 CET 2001

>>>>> "gm" == glen mettler <glen.mettler at> writes:

  gm> These commands will turn a string into a list: 
  gm> myword="dog"
  gm> mywordlist=list(myword)
  gm> result = ["d","o","g"]

  gm> is there a command/function that can take the list ["d","o","g"]
  gm> and make it a string "dog"?

string = "".join(result)

That is, call the join method of the empty string, passing it result
as an argument.


>>> "!".join(result)


More information about the Python-list mailing list