其他

Python 基礎: 其他

type 變數類型

<class ’list’> 串列

list_1 = [1, 2, 3, 4, 5]

print('list_1 type: ', type(list_1))

# list_1 type:  <class 'list'>

<class ‘dict’> 字典

user_dict = {
    "name": "KJ",
    "home": "Taiwan",
    "job": "Developer"
}

print('user_dict type: ', type(user_dict))

# user_dict type:  <class 'dict'>