Low Orbit Flux Logo 2 F

Python How To Zip Two Lists

Python makes it easy to zip two lists. You can pass two lists to the zip function. This will create a zip object. Here is an example showing how you could do that.


a = ['a', 'b', 'c']
b = [1, 2, 3]

c = zip(a, b)     

print(c)

This is almost too easy. I almost feel like I should be required to use at least some logic to make something like this work. Its level of functionality and convenience is one of the things that makes Python so useful.