Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

sleep in Python

  • sleep
import time

start = time.time()
print("hello " + str(start))

time.sleep(3.5)

end = time.time()
print("world " + str(end))
print("Elapsed time:" + str(end-start))
hello 1475217162.472256
world 1475217165.973437
Elapsed time:3.501181125640869