In this example we will show how to return an iterator from a string and print each character in Python.
Source Code
my_str = 'python'
my_iter = iter(my_str)
print(next(my_iter))
print(next(my_iter))
print(next(my_iter))
print(next(my_iter))
print(next(my_iter))
print(next(my_iter))
Output:
p
y
t
h
o
n