(小技巧)怎么样选取字典中包含字典的key-value

a={“name”:“123”,“data”:{“result”:[{“src”:“python1”},{“src”:“python2”},{“src”:“python3”}]}} 怎么样找到 python1/python2/python3

a = {'name':'123','data':{'result':[{'src':'python1'},{'src':'python2'},{'src':'python3'}]}}   #字典

print('第一个:',a['data']['result'][0]['src'])
print('第二个:',a['data']['result'][1]['src'])
print('第三个:',a['data']['result'][2]['src'])

(小技巧)怎么样选取字典中包含字典的key-value_第1张图片
遍历方法:

a = {'name':'123','data':{'result':[{'src':'python1'},{'src':'python2'},{'src':'python3'}]}} 
b = a['data']
c = b['result']
for i in c:
    print(i['src'])

(小技巧)怎么样选取字典中包含字典的key-value_第2张图片

你可能感兴趣的:((小技巧)怎么样选取字典中包含字典的key-value)