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.
运行kernprof时:
kernprof -l script_to_profile.py
输出存储在二进制文件中,可以在终端/命令行中读取。
有没有办法将结果输出到文本文件?
这似乎是有用的功能,但在文档或其他帖子中找不到。
python -m line_profiler script_to_profile.py.lprof > profile_output.txt
将二进制输出转换为文本文件(感谢@martineau)