Python 在字典中添加项目
在字典中添加项目
向字典中添加项目是通过使用新的索引键并向其分配值来完成的:
实例
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["color"] = "red"
print(thisdict)
向字典中添加项目是通过使用新的索引键并向其分配值来完成的:
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["color"] = "red"
print(thisdict)