我们如何用字符串api输出创建字典,如下所示:
API输出:
{
"id":"group_cluster"
,"Fields":{
"SIZE":0
,"REBALANCE":"AUTO"
,"REPLICAS":"1"
,"MODEL":"PARTICIPANT"
,"MODEL_FACTORY_NAME":"group_cluster"
}
,"Fields":{
}
,"mapping":{
"group_0":{
"station08.example.com_98559":"PARTICIPANT"
}
,"group_1":{
"station19.example.com_98559":"PARTICIPANT"
}
,"group_2":{
"station31.example.com_98559":"PARTICIPANT"
}
,"group_3":{
"station44.example.com_98559":"PARTICIPANT"
}
}
想用上面的字符串编一本字典
例如
{
'group_0': 'station08.example.com_98559',
'group_1': 'station19.example.com_98559',
'group_2': 'station31.example.com_98559
}
我试着玩json模块,结果是:
找到解决办法了:
相关问题 更多 >
编程相关推荐