Loop three lists at the same time?
Michael J. Fromberger
Michael.J.Fromberger at Clothing.Dartmouth.EDU
Wed Nov 14 12:00:28 EST 2007
More information about the Python-list mailing list
Wed Nov 14 12:00:28 EST 2007
- Previous message (by thread): Loop three lists at the same time?
- Next message (by thread): Directorio europeo de arte y diseño
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <1194950769.587384.177590 at v23g2000prn.googlegroups.com>, Davy <zhushenli at gmail.com> wrote: > Hi all, > > I have three lists with the same length. Is there any method to loop > the three lists without a loop counter? > > Best regards, > Davy Davy, Look at the "zip" function, <http://docs.python.org/lib/built-in-funcs.html> Look near the bottom of the page. Example: zip([1,2,3], [4,5,6], [7,8,9]) ==> [(1, 4, 7), (2, 5, 8), (3, 6, 9)] Cheers, -M -- Michael J. Fromberger | Lecturer, Dept. of Computer Science http://www.dartmouth.edu/~sting/ | Dartmouth College, Hanover, NH, USA
- Previous message (by thread): Loop three lists at the same time?
- Next message (by thread): Directorio europeo de arte y diseño
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list