2024-09-30 04:41:21 发布
网友
我从一个文件中得到了一些数据:
[ { "Boodie#1932": [ { "cash": 20, "lastHourly": "21$28" } ] } "MrDacom#9952": [ { "cash": 20, "lastHourly": "21$28" } ] ]
现在我想读出“MrDacom#9952”中的现金。我该怎么做? 诸如此类:
data['MrDacom#9952']['cash']
不要工作
以下步骤将起作用
data['MrDacom#9952'][0]['cash']
试试看:data[0]['MrDacom#9952'][0]['cash']
data[0]['MrDacom#9952'][0]['cash']
你的代码 data['MrDacom#9952']['cash'] 无法工作,因为data是一个列表
data
正确的访问方式可以是:
以下步骤将起作用
试试看:
data[0]['MrDacom#9952'][0]['cash']
你的代码
data['MrDacom#9952']['cash']
无法工作,因为data
是一个列表正确的访问方式可以是:
data[0]['MrDacom#9952'][0]['cash']
相关问题 更多 >
编程相关推荐