Concatenating strings
Robert Kern
robert.kern at gmail.com
Fri Jun 30 23:38:19 EDT 2006
John Henry wrote:
> Sorry if this is a dumb question.
>
> I have a list of strings (some 10,000+) and I need to concatenate them
> together into one very long string. The obvious method would be, for
> example:
>
> alist=["ab","cd","ef",.....,"zzz"]
> blist = ""
> for x in alist:
> blist += x
>
> But is there a cleaner and faster way of doing this?
blist = ''.join(alist)
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list