Questions tagged «simplejson»


5
使用Python从JSON获取值
当我尝试从JSON字符串检索值时,它给了我一个错误: data = json.loads('{"lat":444, "lon":555}') return data["lat"] 但是,如果我遍历数据,它将为我提供元素(lat和lon),而不是值: data = json.loads('{"lat":444, "lon":555}') ret = '' for j in data: ret = ret + ' ' + j return ret 哪个返回: lat lon 我需要怎么做才能得到latand的值lon?(444和555)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.