Using for... for multiple lists

Diez B. Roggisch deetsNOSPAM at web.de
Sun Mar 6 07:12:27 EST 2005


> Both filelist and self.checkbox are the same size (4 items btw). Is
> there any way to get this done?

Use zip:

a, b = [1,2,3], ['a', 'b', 'c']
for i,j in zip(a,b):
    print i,j

Or from itertools izip - which should be slightly more performant and less
memory consuming.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list