newbie - concatanating 2 lists

Brett Leach brettlea at earthlink.net
Thu Feb 22 05:51:20 CET 2001


Gnanasekaran Thoppae wrote:
> 
> hi,
> 
> i am just beginning to use python.
> 
> i have:
> 
> li1 = ['a', 'b', 'c']
> li2 = ['x', 'y', 'z']
> 
> i want:
> 
> li3 = ['ax', 'by', 'cz']
> 
> how do i do it?
> 
> thanks
> 
> -gnana

Try this:

li1 = ['a','b','c']
li2 = ['x','y','z']
li3 = []

for i in range( len( li1 ) ):
    li3.append( li1[i] + li2[i] )



More information about the Python-list mailing list