python, Object是python下的一个函数,具体来说就是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__ '' __getattribute__ '' __hash__ '' __init__ '' __le__ '' __lt__ '' __ne__ '' __new__ '' __reduce__ ''' __reduce_ex__ '
以上是边肖的分享,希望对大家有所帮助。
python,以上就是本文为您收集整理的python最新内容,希望能帮到您!更多相关内容欢迎关注。