「Python」ジェネレータ (generator)を使うサンプル
構文
yield 文字列
サンプルコード
# coding: utf-8
#!/usr/bin/python3
def funccft():
yield "Test001"
yield "Test002"
yield "User003"
res = funccft()
print(next(res))
print(next(res))
print(next(res))
実行結果
Test001
Test002
User003