Python 更改字典中的值
更改字典中的值
您可以通过引用其键名来更改特定项的值
示例
将 "year" 更改为 2018
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["year"] = 2018
自己动手试一试 »
您可以通过引用其键名来更改特定项的值
将 "year" 更改为 2018
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["year"] = 2018
自己动手试一试 »
如果您想将 W3Schools 服务用于教育机构、团队或企业,请发送电子邮件给我们
sales@w3schools.com
如果您想报告错误,或想提出建议,请发送电子邮件给我们
help@w3schools.com