mydict =
{
'ServiceResult': {
'msgBody': {
'itemList': [{
'busRouteId': '100100016',
'busRouteNm': '110A',
}, {
'busRouteId': '100100015',
'busRouteNm': '110B',
}, {
'busRouteId': '165000146',
'busRouteNm': '1100',
}, {
'busRouteId': '165000147',
'busRouteNm': '1101',
}, {
'busRouteId': '218000011',
'busRouteNm': '1100',
}, {
'busRouteId': '222000074',
'busRouteNm': '1100',
}, {
'busRouteId': '235000085',
'busRouteNm': '1100',
}, {
'busRouteId': '234000879',
'busRouteNm': '1101',
}, {
'busRouteId': '204000082',
'busRouteNm': 'G8110',
}]
}
}
}
i want to print all of itemList's 'busRouteId' so i write a code
(我想打印所有itemList的“ busRouteId”,所以我写了一个代码)
for i in len(mydict['ServiceResult']['msgBody']['itemList']):
print(mydict['ServiceResult']['msgBody'][i]['busRouteId'])
but it doesn't work and just see this error : TypeError: 'int' object is not iterable how to parse python dict how can i modify it??
(但它不起作用,只是看到此错误:TypeError:'int'对象不是可迭代的如何解析python dict我如何修改它?)
ask by student translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…