0%
简介
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
|
class Test(): def __init__(self,a): self.a = a def run(self): print('run') self.dump() self.sleep()
@classmethod def dump(cls): print('dump') @staticmethod def sleep(): print('i want sleep')
t = Test('a') t.run() t.dump() Test.dump() Test.sleep() t.sleep() print('~~~~~~~~~~~~~~`\n')
class Test1(): def __init__(self,name): self.__name = name
@property def name(self): return self.__name @name.setter def name(self,value): self.__name = value
t1 = Test1(name='dewei') print(t1.name) t1.name = '小木' print(t1.name)
|