Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
https://docs.python.org/3/library/itertools.html#i...
search there pairwise for variant (s0, s1), (s1, s2), ...
for variant (s0, s1), (s2, s3), ...
from itertools import zip_longest
def pairwise(iterable, count):
return zip_longest(*[iter(iterable)] * count, fillvalue=None)
You can try like this:
var = (0,1,2,3,4,5)
var = iter(var)
try:
while True:
a = next(var)
b = next(var)
print(str(a) + " - " + str(b))
except StopIteration:
print('stop')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question