I have a set like (669256.02, 6117662.09, 669258.61, 6117664.39, 669258.05, 6117665.08) which I need to iterate over, like
for x,y in (669256.02, 6117662.09, 669258.61, 6117664.39, 669258.05, 6117665.08) print (x,y)
which would print
669256.02 6117662.09 669258.61 6117664.39 669258.05 6117665.08
im on Python 3.3 btw
To iterate over all pairs of consecutive items in a list with Python, we can use zip with a for loop.
You can use an iterator:
>>> lis = (669256.02, 6117662.09, 669258.61, 6117664.39, 669258.05, 6117665.08) >>> it = iter(lis) >>> for x in it: ... print (x, next(it)) ... 669256.02 6117662.09 669258.61 6117664.39 669258.05 6117665.08
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With