python中快速删除实例对象中的所有属性

def DeleteObjectAllProperties(objectInstance):
    if not objectInstance:
        return
    listPro =[key for key in objectInstance.__dict__.keys()]
    for key in listPro:
        objectInstance.__delattr__(key)

 

posted on 2013-08-25 07:24  |残阳|露  阅读(674)  评论(0编辑  收藏  举报

导航