a = [1,2,3]
b = [4,5,6]
c = [7,8,9]
>>zip(a, b, c)
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
Don't roll your own list transposition functions....
It's also useful for iterating over a couple of related lists:
for message, email in (messages, emails):
hdrs, body = parse_email(email)
assert message in body
No comments:
Post a Comment