P
P
pivazik2020-06-22 19:33:15
Python
pivazik, 2020-06-22 19:33:15

How to get command execution time?

How can I get the execution time of a command in milliseconds?
For example:
Command execution took: 2ms

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Soldovsky, 2020-06-22
@pivazik

Try the time module

import time

start = time.time()
print("hello") # любая другая команда или вызов функции
end = time.time()
print(f"Исполнения команды заняло: {end - start}")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question