python object

python object是怎样的呢?下面就让我们一起来了解一下吧:

object是属于python下的一个函数,具体为object类,object类是属于所有类的父类,简单来说就是其它的任何一个类,都在直接或者间接地继承了object类的属性与方法。

用法即object()

参数:

None

参考范例:

演示object()的工作,输入命令:

# Python 3 code to demonstrate

# working of object()

# declaring the object of class object

obj = object()

# printing its type

print ("The type of object class object is:")

print (type(obj))

# printing its attributes

print ("The attributes of its class are:")

print (dir(obj))

输出结果:

The type of object class object is:

The attributes of its class are:

[‘__class__’, ‘__delattr__’, ‘__dir__’, ‘__doc__’, ‘__eq__’, ‘__format__’, ‘__ge__’, ‘__getattribute__’, ‘__gt__’, ‘__hash__’, ‘__init__’, ‘__le__’, ‘__lt__’, ‘__ne__’, ‘__new__’, ‘__reduce__’, ‘__reduce_ex__’, ‘__repr__’, ‘__setattr__’, ‘__sizeof__’, ‘__str__’, ‘__subclasshook__’]

以上就是小编的分享了,希望能够帮助到大家。

标签:object python

免责声明:本内容来自橡树街平台创作者或收集于互联网公开资源,不代表橡树街网的观点和立场。如有侵权内容,请联系我们删除。联系邮箱:ihuangque@qq.com
相关推荐
python运维是做什么的
2022-08-05
python运维是做什么的
python要学什么
2022-08-05
python要学什么
python 字符转数字
2022-08-05
python 字符转数字
python操作excel表格
2022-08-05
python操作excel表格
python是做什么的
2022-08-05
python是做什么的
python语言是什么语言
2022-08-05
python语言是什么语言
python新手代码
2022-08-05
python新手代码
python是用来干什么的
2022-08-05
python是用来干什么的
python有什么特点
2022-08-05
python有什么特点
python能干什么
2022-08-05
python能干什么
手机老是弹出广告怎么解决
2022-08-05
手机老是弹出广告怎么解决
小爱同学怎么判断我喜欢的人喜不喜欢我
2022-08-05
小爱同学怎么判断我喜欢的人喜不喜欢我
安卓手机如何打开.kmz文件
2022-08-05
安卓手机如何打开.kmz文件
苹果手机文件管理在哪里
2022-08-05
苹果手机文件管理在哪里
安卓手机如何打开.sav文件
2022-08-05
安卓手机如何打开.sav文件
牛龙骨是哪个部位
2022-07-25
牛龙骨是哪个部位
猕猴桃硬的要放多久才能软
2022-07-25
猕猴桃硬的要放多久才能软
天桥区景点
2022-07-25
天桥区景点
hoegaarden什么酒
2022-07-25
hoegaarden什么酒
小烤箱烤蛋挞要几分钟
2022-07-25
小烤箱烤蛋挞要几分钟
玉泽的寓意
2022-07-25
玉泽的寓意
第六代人叫什么
2022-07-25
第六代人叫什么
烤箱烤五花肉一般烤多久
2022-07-25
烤箱烤五花肉一般烤多久
略阳县景点
2022-07-25
略阳县景点
下雨会影响飞机起飞吗
2022-07-25
下雨会影响飞机起飞吗