新聞中心
這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
創(chuàng)新互聯(lián)Python教程:怎么查看python變量值
有時(shí)候我們需要知道變量類型,但不知道如何查看

內(nèi)置函數(shù)isinstance(object, (type1,type2...))
isinstance('content', str)返回
True or False
使用內(nèi)置函數(shù)type(object)
type()就是一個(gè)最實(shí)用又簡(jiǎn)單的查看數(shù)據(jù)類型的方法。type()是一個(gè)內(nèi)建的函數(shù),調(diào)用它就能夠得到一個(gè)反回值,從而知道想要查詢的對(duì)
像類型信息。
type使用方法
>>>type(1)#返回整形 >>>type('content') #返回字符串
type返回值屬于type類型
>>>type(type(1))#返回type類型
更多技術(shù)請(qǐng)關(guān)注Python視頻教程。
分享標(biāo)題:創(chuàng)新互聯(lián)Python教程:怎么查看python變量值
當(dāng)前路徑:http://m.fisionsoft.com.cn/article/djphsdp.html


咨詢
建站咨詢
