Total noob question here but I really want to know the answer.
I have no idea why the zip object simply \"disappears\" after I attempt to iterate through it in its l
zip
creates an object for iterating once over the results. This also means it's exhausted after one iteration:
>>> a = [1,2,3]
>>> b = [4,5,6]
>>> z = zip(a,b)
>>> list(z)
[(1, 4), (2, 5), (3, 6)]
>>> list(z)
[]
You need to call zip(a,b)
every time you wish to use it or store the list(zip(a,b))
result and use that repeatedly instead.