time.sleep()
time.sleep() is a Python function in the Time Module category. Suspends execution for the given number of seconds (may be fractional). The syntax is time.sleep(secs). Parameters: secs — seconds to sleep. Returns: None. A typical example: print("Start")
time.sleep(2.5)
print("After 2.5 seconds"). A close sibling is time.time(), which returns the current Unix timestamp (seconds since epoch). A close sibling is time.gmtime(), which converts a timestamp to a time.struct_time in UTC. A close sibling is time.localtime(), which converts a timestamp to a time.struct_time in local time. A close sibling is time.strftime(), which formats a time.struct_time as a string according to format. More about this category: Time access and conversions — time, sleep, strftime, perf_counter. For a broader walkthrough, read the Time Module guide. Related Time Module entries: time.time(), time.gmtime(), time.localtime(), time.strftime(), time.strptime(), time.perf_counter(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.