[Python Wpg] Sort a list of tuples!

Jason Hildebrand jason at peaceworks.ca
Mon Apr 24 13:46:30 EDT 2006


On Mon, 2006-04-24 at 12:18 -0500, Mark Jenkins wrote:
> This reminds me of a related question, is there a nice pythonish way to
> iterate through too equally sized lists in parallel?

If the lists are the exact same size, the builtin function zip() is
probably what you are looking for:

for item1, item2 in zip(list1, list2):
    # do stuff
    pass

peace,
Jason

-- 
Jason D. Hildebrand
T: 204 775 1212
E: jason at peaceworks.ca





More information about the Winnipeg mailing list