简体   繁体   中英

Kernprof (line_profiler): how to output result as text instead of a binary file

When running kernprof:

kernprof -l script_to_profile.py

The output is stored in a binary file, which can be read in the terminal/command line.

Is there a way to output the results to a text file?

This seems like useful functionality to have, but can't find it in the documentation or in other posts.

python -m line_profiler script_to_profile.py.lprof > profile_output.txt

将二进制输出转换为文本文件(感谢@martineau)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM