I want to print a timer in the console to optimize my script and see how long it takes to run the script.
This is one of the fastest way I know:
import time import random then = time.time() #Time before the operations start #DO YOUR OPERATIONS HERE now = time.time() #Time after it finished print("It took: ", now-then, " seconds")
time.time() Will give you the current time in seconds. There are other way of doing it, but this is one of the best. I have always used this and it gave me no problem at all.