import time inicio = time.perf_counter() # Seu código aqui fim = time.perf_counter() print(fim - inicio)