From Current Time - Program Start Time This is the easiest way.
import time
start_time = time.time()
#Code
print("--- %s seconds ---" % (time.time() - start_time))
It's using something.
For example, the following code is
import time
start_time = time.time()
#####
mylist = []
for i in range(0,10000000):
mylist.append(i)
#####
print("--- %s seconds ---" % (time.time() - start_time))
Output: --- 2.8817028999328613 seconds ---
© 2024 OneMinuteCode. All rights reserved.