[python]sendメソッドを使用する方法

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# coding: utf-8
def funcA(x):
for a in range(10):
b = yield ('world',kk)
if b is not None:
kk = b
tt = funcA("sample")
print(next(tt))
# coding: utf-8 def funcA(x): for a in range(10): b = yield ('world',kk) if b is not None: kk = b tt = funcA("sample") print(next(tt))
# coding: utf-8

def funcA(x):
      for a in range(10):
            b = yield ('world',kk)
            if b is not None:
                  kk = b

tt = funcA("sample")

print(next(tt))

実行結果
('world’,’sample’)

Python

Posted by arkgame