相关疑难解决方法(0)

在python中将Dictionary转换为JSON

r = {'is_claimed': 'True', 'rating': 3.5}
r = json.dumps(r)
file.write(str(r['rating']))
Run Code Online (Sandbox Code Playgroud)

我无法在json中访问我的数据.我究竟做错了什么?

TypeError: string indices must be integers, not str
Run Code Online (Sandbox Code Playgroud)

python json dictionary python-2.7

270
推荐指数
4
解决办法
41万
查看次数

标签 统计

dictionary ×1

json ×1

python ×1

python-2.7 ×1