Extract values one by one

suggest change

Start with iter() built-in to get iterator over iterable and use next() to get elements one by one until StopIteration is raised signifying the end:

s = {1, 2}   # or list or generator or even iterator
i = iter(s)  # get iterator
a = next(i)  # a = 1
b = next(i)  # b = 2
c = next(i)  # raises StopIteration

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents