In this example we will show how to return an iterator from a tuple and print each value in Python.
Source Code
my_tuple = ('a', 'b', 'c')
my_iter = iter(my_tuple)
print(next(my_iter))
print(next(my_iter))
print(next(my_iter))
Output:
a
b
c
In this example we will show how to return an iterator from a tuple and print each value in Python.
my_tuple = ('a', 'b', 'c')
my_iter = iter(my_tuple)
print(next(my_iter))
print(next(my_iter))
print(next(my_iter))
Output:
a
b
c