av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(chuàng)新互聯(lián)Python教程:Python如何查看對(duì)象有哪些內(nèi)容和屬性

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

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

如下代碼:

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

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


[1, 2, 3]

也就是說(shuō)通過(guò)print(type(對(duì)象名))可以輸出對(duì)象類型,print(對(duì)象名)可以輸出對(duì)象的詳細(xì)信息。

2、查看一個(gè)對(duì)象有哪些屬性

使用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ù)請(qǐng)關(guān)注Python視頻教程。


本文標(biāo)題:創(chuàng)新互聯(lián)Python教程:Python如何查看對(duì)象有哪些內(nèi)容和屬性
鏈接地址:http://uogjgqi.cn/article/dhdecco.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問(wèn)/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流