You can use floating-point numbers in sleep()
:
The argument may be a floating point number to indicate a more precise sleep time.
So
time.sleep(0.5)
will sleep for half a second.
In practice, however, it’s unlikely that you will get much more than millisecond precision with sleep because operating systems usually only support millisecond sleeps and because very short amounts of time quickly get unreliable.