whatstyle.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:whatstyle 作者: mikr 项目源码 文件源码
def profile(sourcecode, p_locals, p_globals):
    import cProfile
    import pstats
    prof_filename = os.path.join(tempfile.gettempdir(), "%s.prof" % __file__)
    try:
        cProfile.runctx(sourcecode, p_locals, p_globals, prof_filename)
        p = pstats.Stats(prof_filename)
        p.sort_stats('cumulative').print_stats(40)
    finally:
        os.remove(prof_filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号