Lists into Strings..?

Mark Jackson mjackson at wrc.xerox.com
Wed Aug 29 22:09:08 CEST 2001


tefol at This.Is.Not.An.Address (tefol) writes:

> I am wondering of the best* way to make string equal to an entire list of 
> strings.
> 
> >>> lExistingList = ['spam','Spam','SPAM','bacon','Bacon']
> >>> sNewString = lExistingList
> 
> just doesn't seem to do it.

Is

>>> lExistingList = ['spam','Spam','SPAM','bacon','Bacon']
>>> sNewString = "".join(lExistingList)
>>> print sNewString
spamSpamSPAMbaconBacon

what you were looking for?

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
	Don't talk to the crazy people on the street, even though
	they may seem fun to be with.
	    - /CityPack, New York/ Chinese language edition (1996)





More information about the Python-list mailing list