name: 属于哪个文件
文件的
main
类的
class Person(object):
"""
定义一个类
"""
count = 10
def __init__(self, name, age):
self.name = name
self.age = age
def get_info(self):
print(self.name, self.age)
p = Person('maotai', 22)
p2 = Person('maotai', 22)
# self.属性 属于实例
# 动态添加属性
# p.tel = 13111111111
# print(p2.tel)
# 访问属性和方法
# print(p.name)
# print(p.tel)
# print(Person.__name__)
# print(Person.__module__) # __main__
# print(Person.__doc__)
# print(Person.__dict__)