「python」while文を利用するサンプル
使用例
# coding: utf-8
def funcA(a):
while a < 10:
yield a
a += 1
nn = funcA(0)
print(next(nn))
print(next(nn))
# coding: utf-8
def funcA(a):
while a < 10:
yield a
a += 1
nn = funcA(0)
print(next(nn))
print(next(nn))
# coding: utf-8 def funcA(a): while a < 10: yield a a += 1 nn = funcA(0) print(next(nn)) print(next(nn))
実行結果
0
1