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

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

Use time.sleep()

from time import sleep
sleep(0.05)

Note that if you rely on sleep taking exactly 50 ms, you wont get that. It will just be about it.

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

Use time.sleep():

import time
time.sleep(50 / 1000)

See the Python documentation: https://docs.python.org/library/time.html#time.sleep

Leave a Reply

Your email address will not be published.