python - 我如何查看在 Visual Studio Code 中运行我的程序所花费的时间?

标签 python visual-studio-code compiler-optimization

有没有办法查看脚本在 VS Code 中执行/完成需要多长时间?
我正在寻找这样的消息:

Program finished in 30ms

最佳答案

使用“时间”

当您的脚本启动时:

import time
start_time = time.time()

do something # here your actual code/routine

print("Process finished --- %s seconds ---" % (time.time() - start_time))

关于python - 我如何查看在 Visual Studio Code 中运行我的程序所花费的时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57409385/

相关文章:

javascript - JSX 在纯 JavaScript 文件中工作,如何?

flutter - VISUAL STUDIO CODE 工作时 scrcpy 不工作

c++ - 数据对齐以实现矢量化/高效缓存访问

c++ - 空派生优化

python - 使用 RabbitMQ 有没有办法在没有出队操作的情况下查看队列内容?

python - Scrapy django模型导入错误

node.js - Visual Studio Code - Node.js - 找不到名称 '__dirname'

algorithm - 依赖评估的 DAG 的最佳内存跟踪

python - 如何在 celery 任务执行时停止它并在一段时间后继续执行?

python - Python 中的 DOM 操作(如果某个元素只包含一个其他元素......)