demo_iterator.py:
mytuple = ("apple", "banana", "cherry") myit = iter(mytuple) print(next(myit)) print(next(myit)) print(next(myit))
➜ begtut>python demo_iterator.py
apple
banana
cherry