2024-05-14 20:36:15 发布
网友
我一直在用输入函数来暂停我的脚本
print("something") wait = input("PRESS ENTER TO CONTINUE.") print("something")
有没有正式的方法来做这个?
仅适用于windows使用:
import os os.system("pause")
我想你想在没有输入的情况下暂停
使用
time.sleep(secs)
对我来说似乎很好(或者在Python 2.X中是raw_input())。或者,如果您想暂停一定的秒数,可以使用time.sleep()。
raw_input()
time.sleep()
import time print("something") time.sleep(5.5) # pause 5.5 seconds print("something")
仅适用于windows使用:
我想你想在没有输入的情况下暂停
使用
time.sleep(secs)
对我来说似乎很好(或者在Python 2.X中是
raw_input()
)。或者,如果您想暂停一定的秒数,可以使用time.sleep()
。相关问题 更多 >
编程相关推荐