python - 你能帮忙编辑json吗,我是python的新手。谢谢
问题描述
我需要编辑一些 json 配置,为了节省我的时间,我想使用 python 自动编辑它,但是数据对我来说很复杂,你能帮帮我吗?
tes={
'key':1, 'Test':45, 'name':'Google',
'list':[{
'nameinlist':'name1',
'age':23,
'country':'LA',
'parent':{'name':'World'},
'zipcodeindic':[23,45,66]
}]
}
我想修改
'nameinlist':'name1'->'nameinlist':'name2'
'parent':{'name':'World'} ->'parent':{'name':'World2'}
'zipcodeindic':[23,45,66]->'zipcodeindic':[23,33,66]
解决方案
tes['list'][0]['nameinlist']='name2'
tes['list'][0]['parent']={'name':'World2'}
tes['list'][0]['zipcodeindic']=[23,33,66]
推荐阅读
- r - ggplot错误:无法将类“c(”gg”,”ggplot“)”强制转换为data.frame
- php - 检查 sumbited 单选按钮是否为真 - symfony
- php - 如何在 laravel 5.7 中使用预加载从具有外键的子模型实例中获取父值
- c# - 锁定非静态方法
- gmail - 如何解释 Gmail 用户配额的差距
- python - 从 VBA 到烧瓶的 HTTP 请求的编码问题
- vue.js - 如何获取 — 插值时显示为破折号
- java - 选择联系人java android时获取电子邮件列索引
- ocaml - 为什么使用 _ 防止出现警告
- mysql - 我将如何使用 nodejs sequelize 执行此 SQL 查询?