根据输入执行代码而不按“Enter”

时间:2012-08-24 18:00:16

标签: python

  

可能重复:
  raw_input in python without pressing enter

部分代码:

print "Do you want to (e)ncode?"
option = raw_input("> ")
if option == "e":
    print "Encoding..." # and some other code, which isn't important here
else:
    pass

我想要做的是,如果输入“e”,它会立即执行块中的代码,而不按“Enter”。

这可能吗?如果是,怎么样?

0 个答案:

没有答案
相关问题