recipe-576523.py 文件源码

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

项目:code 作者: ActiveState 项目源码 文件源码
def make_gc_snapShot(filename, name):
        """Append the signatures to a file, giving them the given
        'name'. A signature is a pair object_id / type_name"""
    global first_time
    if first_time:
        gc.collect()
        first_time = False
    contents = []
    for o in gc.get_objects():
        try:
            tname = o.__class__.__name__
        except AttributeError:
            tname = str(type(o))
        contents.append((id(o), tname))
        del tname
    f = open(filename, 'a')
    pickle.dump((name, contents), f)
    f.close()
    del contents
    del f
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号