response = {u'sensors': [{u'objid_raw': 28295, u'objid': 28295}], u'treesize': 1, u'prtg-version': u'21.3.71.1416'}
# First you get the list under 'sensors'
sensors = response['sensors'] # [{u'objid_raw': 28295, u'objid': 28295}]
# sensors is a list now and you want its first entry
entry = sensors[0] # {u'objid_raw': 28295, u'objid': 28295}
# entry now is a dict with the values you need, just extract either of those
objid = entry['objid'] # 28295
# it has the value you want
让我们一步一步来:
或者更简短,正如多人已经提到的:
因为我可以看到2个值为28295的键,所以这里是我的通用anwser
相关问题 更多 >
编程相关推荐