日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:Python如何查看對象有哪些內(nèi)容和屬性

python如何查看對象有哪些內(nèi)容和屬性

1、查看python對象的內(nèi)容方法:

如下代碼:

a = [1,2,3]
print(type(a))
print(a)

執(zhí)行結(jié)果是:


[1, 2, 3]

也就是說通過print(type(對象名))可以輸出對象類型,print(對象名)可以輸出對象的詳細信息。

2、查看一個對象有哪些屬性

使用dir命令,如

text="string"
dir(text)

執(zhí)行結(jié)果是:

['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribut
e__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt
__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', 
'__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'ca
pitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', '
isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', '
replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip
', 'swapcase', 'title', 'translate', 'upper', 'zfill']

更多技術(shù)請關(guān)注Python視頻教程。


本文名稱:創(chuàng)新互聯(lián)Python教程:Python如何查看對象有哪些內(nèi)容和屬性
網(wǎng)頁鏈接:http://www.5511xx.com/article/dhdecco.html