--- title: 5.群集-dictionary說明與實作 tags: Python 進階語法與應用, 筆記 --- ### 群集 #### 1. List 清單(排隊): 同類型 [0,0,0,] - 順序性 - (使用上)同類型 --- #### 2. Dictionary 字典 (把很多不同類型資料聚集一起)聚集不同 {資料名稱:值, 資料名稱:值,....} - 沒有順序性 - 聚集不同類型 複雜資料 {"name":"Ewing","height":175,"handsome":True} ---- 取的背後的東西:字典名字[名字] person={"name":"Elwing","height":275, "handsome":True} print(person) #取出東西:print(name) print(person["name"]) #新增一個名字:eight = 75 person["weight"]=75 print(person) #更改名字背後的值:height =177 person["height"]=177 print(person) #取出來 做完運算再設定回去:height=height+3 person["height"]=person["height"]+3 print(person) # END