python object是怎樣的呢?下面就讓我們一起來了解一下吧:
object是屬于python下的一個函數(shù),具體為object類,object類是屬于所有類的父類,簡單來說就是其它的任何一個類,都在直接或者間接地繼承了object類的屬性與方法。
用法即object()
參數(shù):
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))
輸出結(jié)果:
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__’]
以上就是小編的分享了,希望能夠幫助到大家。
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com