Login
From:
learnbyexample
(Uncensored)
subscribe
Python tip 31: next() function
https://learnbyexample.github.io/tips/python-tip-31/
links
backlinks
Roast topics
Find topics
Find it!
The next() builtin function can be used on an iterator (but not iterables) to retrieve the next item. Once you have exhausted an iterator, trying to get another item will result in a StopIteration exception. Here's an example: