list to string
sheila at spamcop.net
Tue Feb 27 08:22:03 CET 2001
On Tue, 27 Feb 2001 07:16:22 GMT, "Wayne Izatt"
<wayne.izatt at _nospam_myself.com> wrote in comp.lang.python in article
<avIm6.174966$df5.5092180 at news1.crdva1.bc.home.com>:
:"glen mettler" <glen.mettler at home.com> wrote in message
:news:1103_983241679 at cc462845-a...
:> These commands will turn a string into a list:
:> result = ["d","o","g"]
:> is there a command/function that can take the list ["d","o","g"] and make
:it a string "dog"?
:>>> lst =["d", "o", "g"]
:['d', 'o', 'g']
:>>> dog = lst+lst+lst
: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.
More information about the Python-list