Batch 的 PAUSE 函数的 Python 等价物是什么
What is the Python Equivalent of Batch's PAUSE function
Batch 的
的 Python 等价物是什么
PAUSE
功能?程序应等待用户按下一个键才能继续。
暂停几秒,看看time.sleep
。
要等待输入(如果愿意,可以丢弃它),使用input
or raw_input
。
等待任何输入,this answer建议(仅windows):
import msvcrt as m
def wait():
m.getch()
同一线程中的 following answer 建议使用可用的外部工具(不是 windows),read
:
os.system('read -s -n 1 -p "Press any key to continue..."')
Batch 的
的 Python 等价物是什么PAUSE
功能?程序应等待用户按下一个键才能继续。
暂停几秒,看看time.sleep
。
要等待输入(如果愿意,可以丢弃它),使用input
or raw_input
。
等待任何输入,this answer建议(仅windows):
import msvcrt as m
def wait():
m.getch()
同一线程中的 following answer 建议使用可用的外部工具(不是 windows),read
:
os.system('read -s -n 1 -p "Press any key to continue..."')