最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

[Python]反射練習(xí)

2023-04-27 14:49 作者:AkJJXD  | 我要投稿

class People:
? ?country_or_region='China'
? ?def __init__(self, name):
? ? ? ?self.name = name
? ?def tell(self):
? ? ? ?print('%s is name' %self.name)
obj = People('ak')

# hasattr()
# getattr()
# setattr()
# delattr()
# print('country' in People.__dict__)
# print(hasattr(People, "country_or_region"))
# print(hasattr(People, "name"))
# print(hasattr(People, "tell"))
# print(hasattr(obj, "country_or_region"))
# print(hasattr(obj, "name"))
# print(hasattr(obj, "tell"))
# print(getattr(obj,'country_or_region'))
# print(getattr(obj,'name'))
# print(getattr(obj,'tell',None))
# f = getattr(obj,'tell',None)
# obj.tell()
# f()
# People.date ?= '2023'
# print(People.date)
# setattr(People,'date','2023')
# obj1 = People('ak')
# print(obj1.date)
# print(People.date)
# obj.age = 20
# print(obj.age)
# obj1 = People('kk')
# setattr(obj1,'age',21)
# print(obj1.age)
# print(obj1.__dict__)
# del People.country_or_region
# print(People.__dict__)
# delattr(People,'country_or_region')
# print(People.__dict__)
# del obj.name
# print(obj.__dict__)
# delattr(obj,'name')
# print(obj.__dict__)




[Python]反射練習(xí)的評論 (共 條)

分享到微博請遵守國家法律
玉屏| 林周县| 宣恩县| 灵寿县| 三原县| 昌宁县| 遵义市| 潞西市| 博白县| 德昌县| 洛阳市| 慈利县| 眉山市| 兴安盟| 桦甸市| 绥宁县| 靖远县| 宣威市| 贡山| 沐川县| 介休市| 桓台县| 新疆| 郑州市| 板桥市| 闵行区| 英德市| 河池市| 武山县| 会宁县| 崇明县| 怀宁县| 凤庆县| 酉阳| 久治县| 澄迈县| 鲁甸县| 天气| 沧州市| 卓资县| 孝感市|