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).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…