First page Back Continue Last page Overview Graphics

Simple Example

>>> def abc_generator():

... yield "a"

... yield "b"

... yield "c"

...

>>> for i in abc_generator():

... print(i)

...

a

b

c

>>>

Generators are as easy as the

ABC