📜  中断输入循环 - Python 代码示例

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

代码示例1
import sys, select

print "You have ten seconds to answer!"

i, o, e = select.select( [sys.stdin], [], [], 10 )

if (i):
  print "You said", sys.stdin.readline().strip()
else:
  print "You said nothing!"