How can I sleep 50 ms on Python program?

Asked 2 years ago, Updated 2 years ago, 94 views

How do I get 50 ms sleep for Python program?

The parameter for sleep is seconds, so it sleeps only in seconds.

What method do you use to sleep for 50ms?

time sleep python

2022-09-21 21:08

1 Answers

time.If you look at sleep(secs),

... The argument may be a floating point number to indicate a more precise sleep time ...

That's what it says. Just because the parameter name is secs doesn't mean it's an integer You may make mistakes.

from time import sleep
sleep(0.05)

You can write like


2022-09-21 21:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.