Python「內建函數」(built-in functions)就是不用 import,隨時可以直接呼叫的函數,像 print()、len()、range() 這些,都算。
type():看這東西是什麼型別
語法:
type(obj)例子:
print(type(123)) # int
print(type("hello")) # str
print(type([1, 2, 3])) # list
print(type({"a": 1})) # dict
常見用途:
- 除錯時,看變數長什麼樣
- 做防呆(雖然實務上比較常用
isinstance(),那之後再講)












