How do I get my Python program to sleep for 50 milliseconds?

和自甴很熟 提交于 2019-12-17 06:23:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!