Converting a list to a string

Daniel Klein DanielK at aracnet.com
Tue Dec 19 14:46:26 EST 2000


My application needs to be able to convert a list to a string and vice
versa. Taking the first problem, the best I could come up with is

s = ''
for i in range(len(mylist)):
    s += mylist[i]

Of course, I would turn this into a function (or better yet a class method).

Is here a builtin function to do this that I'm missing? Or is this as good
as it can get?

Thanks,
Daniel Klein





More information about the Python-list mailing list