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.

Answer from Joey on Stack Overflow
🌐
Python
docs.python.org › 3 › library › time.html
time — Time access and conversions
It does not include time elapsed during sleep. It is process-wide by definition. The reference point of the returned value is undefined, so that only the difference between the results of two calls is valid. Use process_time_ns() to avoid the precision loss caused by the float type.
🌐
Quora
quora.com › In-Python-does-time-sleep-work-for-float-or-just-integers-and-if-only-for-integers-how-can-I-get-the-program-to-pause-for-1-87-seconds
In Python, does time.sleep() work for float or just integers, and if only for integers how can I get the program to pause for 1.87 seconds? - Quora
Answer (1 of 7): Yes, it works with [code ]float[/code] arguments, not just [code ]int[/code]. The Python documentation [1] is clear on this. > Suspend execution of the calling thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep t...
🌐
Tutorialspoint
tutorialspoint.com › python › time_sleep.htm
Python time sleep() Method
However, this method only halts the execution of a specific thread; and not the entire program. The argument accepted by this method may be a floating point number to indicate a more precise sleep time.
🌐
DataCamp
datacamp.com › tutorial › python-time-sleep
Python time.sleep() Function | DataCamp
January 31, 2019 - The syntax for the function is: time.sleep(sec) where sec is the argument that specifies the number of seconds the program is to be suspended for. The function does not return any value. sec - The argument is actually a floating point number, hence you can make the sleep time more precise.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-time-sleep
Python time.sleep(): How to Pause Execution in Python Scripts | DigitalOcean
January 27, 2026 - The argument passed to time.sleep() can also be a floating-point value to create more precise delays.
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › sleep-in-python
time.sleep() in Python - GeeksforGeeks
August 18, 2022 - We must import the time module before using perf_counter() so we can access the function without throwing any errors.The perf_counter() function always returns the float value of time in seconds.
🌐
Programiz
programiz.com › python-programming › time › sleep
Python sleep() (With Examples)
import time print("Printed immediately.") time.sleep(2.4) print("Printed after 2.4 seconds.") ... Printed immediately. Printed after 2.4 seconds. ... import time while True: # get current local time as structured data current_time = time.localtime() # format the time in 12-hour clock with AM/PM formatted_time = time.strftime("%I:%M:%S %p", current_time) print(formatted_time) time.sleep(1)
🌐
MindMajix
mindmajix.com › blog › python › python sleep method
Sleep Method in Python
In Python, Sleep() function is used to delay program execution. It pauses the execution for a given number of seconds and can take floating-point numbers for more precise sleep time. The suspension time may vary.
🌐
StrataScratch
stratascratch.com › blog › python-sleep-function
How to Use Python’s Sleep Function - StrataScratch
October 14, 2025 - You call Python sleep() by giving it a number. That number sets how many seconds the program will pause. sleep() accepts both integers and floats. This gives you flexibility for short or long delays. Before using sleep(), let’s import it from the time module:
🌐
Centron
centron.de › startseite › python time sleep() function
Python time sleep() function
February 6, 2025 - The argument can be in floating value also to have more precise delay. For example you want to make delay for 100 milliseconds which is 0.1 seconds, as following: ... Let’s see the following example of python time sleep function.
🌐
Python Central
pythoncentral.io › pythons-time-sleep-pause-wait-sleep-stop-your-code
Python's time.sleep() - Pause, Stop, Wait or Sleep your Python Code | Python Central
December 30, 2021 - While using this function, we can specify the delay, and the compiler will execute the fixed time delay. The syntax of this function is as follows: secs - The number of seconds the Python program should pause execution. This argument should ...
🌐
Linux Hint
linuxhint.com › python-time-sleep-milliseconds
Python Time.sleep Milliseconds – Linux Hint
The “time” library provides a function “sleep()” that takes the delay interval in seconds, and the best part about this function is that it can take float values. This simply means that it allows the users to pass the time in milliseconds as well.
🌐
Progressive Robot
progressiverobot.com › home › tutorials › how to use time.sleep() in python: complete guide (2025–2026)
How to Use time.sleep() in Python: Complete Guide (2025–2026) - Progressive Robot
February 6, 2026 - All examples are tested on Python 3.10–3.13. It pauses only the current thread — other threads continue running in multithreaded programs. Accepts float values for precise delays (e.g., time.sleep(0.5) = 500 ms).
Address   Chester Business Park, 220 Heronsway, CH4 9GB
🌐
Mimo
mimo.org › glossary › python › time-sleep
Python time sleep: Pausing Code Execution in Python
Start your coding journey with Python. Learn basics, data types, control flow, and more ... To use the time.sleep() function, you need to import Python's time module.
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › python time.sleep(): how to delay code execution
Python time.sleep(): How to Delay Code Execution
April 30, 2025 - Use time.sleep() in a loop to delay each loop step. ... The code prints the current step and waits 1 second before printing the following. Use floating-point values to delay the program in milliseconds:
🌐
Hostman
hostman.com › tutorials › how to use python time.sleep()
How to Use Python time.sleep() | Hostman
October 20, 2025 - The number passed to the function can be either an integer or a float, which allows sleeping for fractions of a second. ... The time.sleep() function does not return any value. That means you cannot precisely determine how accurate the pause ...
Price   $
Address   1999 Harrison St 1800 9079, 94612, Oakland