我想知道如何在 Python 脚本中设置时间延迟.
I would like to know how to put a time delay in a Python script.
import time
time.sleep(5) # Delays for 5 seconds. You can also use a float value.
这是另一个大约每分钟运行一次的示例:
Here is another example where something is run approximately once a minute:
import time
while True:
print("This prints once a minute.")
time.sleep(60) # Delay for 1 minute (60 seconds).
这篇关于如何在 Python 中进行时间延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!