Concatenating strings

Steven Bethard steven.bethard at gmail.com
Fri Jun 30 23:36:24 EDT 2006


John Henry wrote:
> 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)

STeVe



More information about the Python-list mailing list