[python] 檢視資料類型:type()


如果當你在處理資料,但不清楚資料類型的話,可以使用
type function,像是:
>>> print(type("a"))

輸出:
<class 'str'>

如果輸入:
>>> print(type(2))
則輸出 <class 'int'>

輸入:
>>> print(type(2.5))
則輸出 <class 'float'>


留言