Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个程序通过使用子进程中的 popen 调用几个外部脚本。现在我想介绍这个程序。虽然我可以使用 cProfile 轻松分析 python 代码,但我没有得到有关不同外部脚本运行时间的信息。
我想避免用计时器弄乱每一个 popen 调用。
谢谢!
正如西蒙所说,您只需要编写一次计时代码。一种方法是装饰popen 函数。