面向对象进阶(day7)

1class Foo(object):pass2class Foo(object):passclass Bar(Foo):pass119822112None342class BlackMedium:'Ugly'def __init__(self,name,addr):def sell_house(self):'%s 黑中介卖房子啦,×××才买呢,但是谁能证明自己不×××'def rent_house(self):'%s 黑中介租房子啦,×××才租呢''万成置地''回龙观天露园'#检测是否含有某属性'name''sell_house'#获取属性'name''rent_house'# getattr(b1,'aaaaaaaa') #报错'aaaaaaaa''不存在啊'#设置属性'sb'True'show_name'lambda'sb'#删除属性'addr''show_name''show_name111'#不存在,则报错3class Foo(object):"old boy"def __init__(self):'wupeiqi'def func(self):return'func'            @staticmethoddef bar():return'bar'print'staticField'print'func'print'bar'4importdef s1():print's1'def s2():print's2''s1''s2'3,如需转载请自行联系原作者

你可能感兴趣的:(面向对象进阶(day7))