类名为People,说一下下面这些特殊属性的作用。People.__dict__People.__module__People.__doc__class People():'''这是人类,我是这个类的注释'''def __init__(self, username, age):self.username = usernameself.age = agedef run(self):'''定义人的跑得功能:return:'''print(self.username + ' can run!')
people = People('Tom', 12)
print(people.__doc__)
print(people.__module__)
print(people.__dict__)
#people.run()#依次输出
这是人类,我是这个类的注释
__main__
{
'username': 'Tom', 'age': 12}
#总结:
#__dict__ : 类的属性(包含一个字典,由类的数据属性组成)
#__module__:类定义时所在的模块此处为 __main__ 若位于导入模块ptest下那么该值应为 ptest
#__doc__ :类的注释文档
详细解决方案
类名为People,说一下下面这些特殊属性的作用。 People.__dict__ People.__module__ People.__doc__
热度:29 发布时间:2023-12-22 08:07:44.0
相关解决方案
- 施用window.open("people.xls"'_blank');下载xls表
- 小弟我远程连一个oracle数据库 想把那个数据库里面的Peopleinfo表里面的name字段下的数据 弄到小弟我的数据库里面的 People 表 里面的XM字段下面
- If the World Were a Village of 100 People,该如何解决
- I People Counting
- 网易100天---27、How Do People Lubricate Artificial Intelligence?
- Leetcode 1452. People Whose List of Favorite Companies Is Not a Subset of Another List (python)
- Python中魔法方法__init__、__doc__、__del__、__str__
- 二维无序LIS ACdream1216 Beautiful People
- AttributeError: 'numpy.ufunc' object has no attribute '__module__'问题解决方案
- 类名为People,说一下下面这些特殊属性的作用。 People.__dict__ People.__module__ People.__doc__
- 【Codeforces Round #111 (Div. 2) E. Buses and People】离散化+线段树
- acd - 1216 - Beautiful People(二维LIS)
- Three things can't discuss with with people: Religion, Politics and The Great Pumpkin. Why?为什么不能谈论?
- Codeforces Round #111 (Div. 2) E题 Buses and People 线段树+离散化
- LeetCode 1103. Distribute Candies to People (Java版; Easy)
- 【论文阅读】Generating 3D People in Scenes without People
- People Tracking by Cooperative Fusion of RADAR and Camera Sensors