stay python in ,datetime Is a time module , Under this module, there is also a datetime Class , This class can be called through the following code , Count the running time of the program , Get the time difference .
from datetime import datetime
from datetime import datetime
now1 = datetime.now()# Count the start time of the program
for i in range(0,1000000):
print(i)
now2 = datetime.now()# Count the time when the program ends
print(now2-now1)# Get the total running time of the program
The rendered results are displayed in hours, minutes and seconds .
If you will Python Code is aut