how do i merge two sequence

Ervin Hegedüs airween at gmail.com
Thu Apr 19 02:31:38 EDT 2012


hi,

On Wed, Apr 18, 2012 at 10:41:00PM +0200, Peter Otten wrote:
> Python Email wrote:
> 
> > how do i merge two seqs alernative;
> > 
> > ("xyz", "7890")
> > output: x7y8z90
> 
> >>> import itertools
> >>> "".join(a+b for a, b in itertools.izip_longest("xyz", "7890", 
> fillvalue=""))
> 'x7y8z90'

why is this better than simple "".join(("xyz", "7890"))?


thanks:


a.
 

-- 
I � UTF-8



More information about the Python-list mailing list