1import time
2
3print("Printed immediately.")
4time.sleep(2.4)
5print("Printed after 2.4 seconds.")
1import time
2
3print("Print now")
4time.sleep(4.2)
5print("Printing after 4.2 seconds")
1#!/usr/bin/python3
2import time
3
4print ("Start : %s" % time.ctime())
5time.sleep( 5 )
6print ("End : %s" % time.ctime())
7
8# Start : Mon Feb 15 12:08:42 2016
9# End : Mon Feb 15 12:08:47 2016
1import time
2
3start = time.time()
4print("sleeping...")
5time.sleep(0.5)
6print("woke up...")
7elapsed_time = time.time() - start
8
9print("elapsed time:", elapsed_time * 1000, "milliseconds")