In Python 3, no raw_input()
exists.
(在Python 3中,不存在raw_input()
。)
So, just use: (因此,只需使用:)
input("Press Enter to continue...")
In Python 2, you should use raw_input()
, as input(prompt)
is equivalent to eval(raw_input(prompt))
:
(在Python 2中,您应该使用raw_input()
,因为input(prompt)
等效于eval(raw_input(prompt))
:)
raw_input("Press Enter to continue...")
This only waits for a user to press enter though, so you might want to use msvcrt ((Windows/DOS only) The msvcrt module gives you access to a number of functions in the Microsoft Visual C/C++ Runtime Library (MSVCRT)):
(但是,这仅等待用户按Enter键,因此您可能要使用msvcrt ((仅适用于Windows / DOS)使用msvcrt模块可以访问Microsoft Visual C / C ++运行时库(MSVCRT)中的许多功能):)
import msvcrt as m
def wait():
m.getch()
This should wait for a key press.
(这应该等待按键。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…