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)
亲自试一试 »
