class Hello:
'''this is a class'''
school='luffy' #类的变量
def say(self):
print('hello!')
def __init__(self): #绑定给对象的属性
self.a = 'a'
self.b = 'b'
@classmethod
def ddd(self):
print('')
for i in self.__dict__:
print(i, self.__dict__[i], sep=' \t')
print('==类的名称空间字典:')
for i in Hello.__dict__:
print(i, Hello.__dict__[i], sep=' \t')
print('=========')
print('==Hello cls')
Hello.ddd()
print('=========')
print('===student===')
student1 = Hello()
for i in student.__dict__:
print(i,student.__dict__[i], sep=' \t')
print('======')
print('===sutdent.cls===')
student1.ddd()
you = Hello()
you.say()
# 增
student1 = Luffycity()
# 查
print(student1.a)
# 改
student1.b = 'gai'
# 删
del student1
class Luffycity:
'''this is a class'''
school='luffy' #类的变量
def __init__(self): #绑定给对象的属性
self.a = 'a'
self.b = 'b'
def aaa(self): #绑定给对象的方法
pass
@property #属性化的方法
def bbb(self):
pass
@staticmethod #类的静态方法
def ccc():
pass
@classmethod #绑定给类的方法
def ddd(cls):
print('')
for i in cls.__dict__:
print(i, cls.__dict__[i], sep=' \t')