Using a select call is shorter, and should be much more portable
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!"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…