我有一个 static func ClickAction(Button: Button, viewController: UIViewController) {
//...
viewController.present(...
}
文件,其中包含以下详细信息:
JSON
我想解析上面的json文件并获取Name,Place,Path并将它们存储到变量中,然后获取city,landmark和pin并将它们存储到数组中。我怎么能用Python做到这一点。我已经尝试过搜索,但我能找到的只是读取json文件而不是这样解析它。
我读取json的Python代码:
{
"Name":"TESTING",
"Place":"India",
"Path":"Road",
"Details":
[
{
"city":"",
"landmark":"aaabbbcccc",
"pin":"500001"
},
{
"city":"",
"landmark":"aaabbbcccc",
"pin":"500001"
},
{
"city":"",
"landmark":"xxxyyyzzzz",
"pin":"510009"
}
]
}
答案 0 :(得分:0)
试试这个城市:
for i in data['Details']:
print i['city']