Python 3.2
t = (1, 2, 3)
t2 = (5, 6, 7)
z = zip(t, t2)
for x in z:
print(x)
Result:
(1, 5)
(2, 6)
(3, 7)
Putting in EXACTLY the same loop immediately after, nothing is printed:
for x in z:
print(x)
z
still exists as <zip object at 0xa8d48ec>
. I can even reassign the t
, t2
to be zipped again, but then it only works once and only once, again.
Is this how its supposed to work? There's no mention in the docs about this.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…