问题
How do I get my Python program to sleep for 50 milliseconds?
回答1:
from time import sleep
sleep(0.05)
Reference
回答2:
Note that if you rely on sleep taking exactly 50 ms, you won't get that. It will just be about it.
回答3:
import time
time.sleep(50 / 1000)
回答4:
can also using pyautogui as
import pyautogui
pyautogui._autoPause(0.05,1)
_autoPause(time1,time2):
it Pauses the command for time1*time2 sec
time1 refers to how many secs you want
time2 refers to repeat how many time
both can be floats
for example
pyautogui._autoPause(0.1,0.2)
will Pause for 0.1*0.2 = 0.02 sec
来源:https://stackoverflow.com/questions/377454/how-do-i-get-my-python-program-to-sleep-for-50-milliseconds