python array generator code example
Example 1: generator expressions python
>>> iterator = ('Hello' for i in range(3))
>>> for x in iterator:
... print(x)
'Hello'
'Hello'
'Hello'
Example 2: generator expressions python
def generator():
for item in collection:
yield expression