simultaneous iteration of lists

Andrew McNamara andrewm at object-craft.com.au
Wed Jul 17 02:33:53 EDT 2002


>The syntax that is in the back of my brain looks something like 
>
>for i,j in list1,list2:
>	print i
>	print j

Try this:

    for i, j in zip(list1, list2):
            print i, j

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/





More information about the Python-list mailing list