How to unpack key,value pairs in python?
This question already has an answer here:
Like this - first:
for obj in objArray:
for key in obj:
value = obj[key]
print(key)
print(value)
Second (python 3):
for obj in objArray:
for key, value in obj.items():
print(key)
print(value)
For python 2 you can use for key, value in d.iteritems()
上一篇: 解析嵌套的JSON响应Python
下一篇: 如何解开python中的键值对?