📜  __delattr__ python 代码示例

📅  最后修改于: 2022-03-11 14:45:15.391000             🧑  作者: Mango

代码示例1
class test:
    attr = 1

    def __delattr__(self, item):
        object.__delattr__(self, item)

ins = test()

print(ins.attr)

del ins.attr

print(ins.attr)