我想知道一种简单的方法来等待用户按下特定的键,例如 Enter 或 Escape (但不是两者),然后在感应到按键后进一步执行代码。
Try:
raw_input('Press enter to continue: ')
或者,在 Python 3 中:
input('Press enter to continue: ')