新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python中dir函數(shù)是啥意思
python中的DIR()函數(shù)

創(chuàng)新互聯(lián)專注于衡山網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供衡山營銷型網(wǎng)站建設(shè),衡山網(wǎng)站制作、衡山網(wǎng)頁設(shè)計(jì)、衡山網(wǎng)站官網(wǎng)定制、小程序開發(fā)服務(wù),打造衡山網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供衡山網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。
dir() 函數(shù)不帶參數(shù)時(shí),返回當(dāng)前范圍內(nèi)的變量、方法和定義的類型列表;帶參數(shù)時(shí),返回參數(shù)的屬性、方法列表。如果參數(shù)包含方法__dir__(),該方法將被調(diào)用。如果參數(shù)不包含__dir__(),該方法將限度地收集參數(shù)信息。
dir 語法:
dir([object])
參數(shù)說明
object -- 對象、變量、類型。
返回值
返回模塊的屬性列表。
以下實(shí)例展示了 dir 的使用方法:
>>>dir() # 獲得當(dāng)前模塊的屬性列表 ['__builtins__', '__doc__', '__name__', '__package__', 'arr', 'myslice'] >>> dir([ ]) # 查看列表的方法 ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] >>>
新聞標(biāo)題:創(chuàng)新互聯(lián)Python教程:python中dir函數(shù)是啥意思
轉(zhuǎn)載來于:http://fisionsoft.com.cn/article/djsciii.html


咨詢
建站咨詢
