generator list python code example
Example 1: generator expressions python
>>> even_squares = (x * x for x in range(10)
if x % 2 == 0)
Example 2: generator expressions python
>>> genexpr = ('Hello' for i in range(3))
>>> list(genexpr)
['Hello', 'Hello', 'Hello']