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

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


Solution 1:

Use time.sleep()

from time import sleep
sleep(0.05)

Solution 2:

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