如何查看在 Visual Studio Code 中运行我的程序所需的时间?

Nie*_*ens 8 python compiler-optimization visual-studio-code

有没有办法查看脚本在 VS Code 中执行/完成需要多长时间?

我正在寻找这样的消息:

Program finished in 30ms
Run Code Online (Sandbox Code Playgroud)

Mae*_*ex1 5

使用“时间”

当您的脚本启动时:

import time
start_time = time.time()

do something # here your actual code/routine

print("Process finished --- %s seconds ---" % (time.time() - start_time))
Run Code Online (Sandbox Code Playgroud)