from datetime import datetime start = datetime.now() your_func() end = datetime.now() print(end - start)