# __author: "ZXYang"
# date: 2020/12/12
"""
yield
生成器表达式:send, close, throw
aa.close()
print(aa.throw(ValueError))
"""
aa = (i for i in range(10))
print(next(aa))
print(next(aa))
# aa.close()
print(aa.throw(ValueError))
print(next(aa))
原文:https://www.cnblogs.com/zxy01/p/14123851.html