next iterator example
This commit is contained in:
parent
682e04acbe
commit
f950c99479
11
python-temel/next.iterator.py
Normal file
11
python-temel/next.iterator.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
def foo():
|
||||
x = yield
|
||||
print(x)
|
||||
|
||||
try:
|
||||
iterator = foo()
|
||||
val = next(iterator) # val = iterator.send(None)
|
||||
print(val)
|
||||
next(iterator) # iterator.send(None)
|
||||
except StopIteration:
|
||||
pass
|
Loading…
Reference in New Issue
Block a user