溫馨提示×

python中type的用法是什么

小億
95
2024-01-09 19:06:12
欄目: 編程語言

在Python中,type()是一個內置函數,用于獲取對象的類型。

type()的語法為: type(object)

其中,object是要檢查其類型的對象。

type()函數的返回結果是一個type對象,表示對象的類型。

例如: x = 5 print(type(x)) # <class ‘int’>

y = “hello” print(type(y)) # <class ‘str’>

z = [1, 2, 3] print(type(z)) # <class ‘list’>

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女