我已经在 DOS 窗口中启动了 python。它显示“Python 3.12.0”...... 但如果我输入“quit()”,我会收到消息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'quit' is not defined
现在我无法退出Python。为什么?
在 Python 中,您可以通过键入
exit()
或按 Ctrl + Z 后按 Enter(在 Windows 上)退出解释器。
尝试使用
exit()
而不是 quit()
在 DOS 窗口中退出 Python 解释器。
您也可以使用
exit(0)
退出 Python 解释器。