📜  python 在等待输入时做一些事情 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:58.990000             🧑  作者: Mango

代码示例1
from threading import Thread
from time import sleep

result = None

def update_every_second():
    while result is None:
        sleep(1)
        print "update"

t = Thread(target=update_every_second)
t.start()
result = raw_input('? ')

print "The user typed", result