convert a list to a string?

Tony Meyer t-meyer at ihug.co.nz
Fri Mar 4 04:10:46 CET 2005


> Suppose I have a list 
> 
> myList = ["this", "is", "a", "sample", "list"]
> 
> If I don't want to iterate through it and concatenate
> the list elements, how do I easily convert it to a
> string like
> 
> "this is a sample list"

" ".join(myList)

=Tony.Meyer




More information about the Python-list mailing list