def cor(txt):
print “coroutine start”
while True:
line = (yield) #send로 전달받은 값을 line에 저장
if txt in line:
print line
c=cor(“py”) #코루틴 초기화
c.next() #코루틴 실행
c.send(“show me the money”) #코루틴에 값 전달
c.send(“snoopy”)
c.send(“black sheep wall”)
c.send(“python”)
c.close() #코루틴 종료