rank vote view answer url
25 2132 2306176 12 url

在 Python 里如何手工进行延迟?


import time
time.sleep(5)   # Delays for 5 seconds. You can also use a float value.

这里有另一个例子展示每隔差不多一分钟运行一次:

import time
while True:
    print("This prints once a minute.")
    time.sleep(60) # Delay for 1 minute (60 seconds).