2024-04-29 07:30:38 发布
网友
如果我做了这样的事
python -m cProfile -o profile.prof myprogram.py
你能从有权访问profile.prof的地方重建源代码吗
profile.prof
所有.prof文件包含的是一个^{} serialisation的统计数据,与您在不使用-o时看到的数据相同(因此打印这些数据)
.prof
-o
它基本上是一个在函数“label”上键入的字典,包含每个函数调用的统计信息。函数标签定义为:
def label(code): if isinstance(code, str): return ('~', 0, code) # built-in functions ('~' sorts at the end) else: return (code.co_filename, code.co_firstlineno, code.co_name)
因此只记录文件名、行号和函数名,而不记录其他内容。你不能从这个重建一个完整的程序
所有} serialisation 的统计数据,与您在不使用
.prof
文件包含的是一个^{-o
时看到的数据相同(因此打印这些数据)它基本上是一个在函数“label”上键入的字典,包含每个函数调用的统计信息。函数标签定义为:
因此只记录文件名、行号和函数名,而不记录其他内容。你不能从这个重建一个完整的程序
相关问题 更多 >
编程相关推荐