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

歡迎光臨散文網(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í)的評論 (共 條)

分享到微博請遵守國家法律
曲周县| 丰城市| 安陆市| 辽宁省| 长丰县| 永城市| 获嘉县| 三都| 宾川县| 武城县| 颍上县| 庆元县| 个旧市| 新化县| 吉安县| 彰武县| 苗栗市| 巫溪县| 莱州市| 武强县| 察雅县| 莱芜市| 麻江县| 福建省| 蛟河市| 浪卡子县| 岳阳县| 张家口市| 定远县| 株洲县| 滦南县| 湘乡市| 眉山市| 巴彦淖尔市| 定结县| 和静县| 永寿县| 文山县| 黎平县| 赞皇县| 赣州市|