l = [
{'bob':'hello','jim':'thanks'},
{'bob':'world','jim':'for'},
{'bob':'hey','jim':'the'},
{'bob':'mundo','jim':'help'}
]
for dict in l:
print dict['jim']
Run Code Online (Sandbox Code Playgroud)
有这样的单线或pythonic方式吗?我正在尝试检索词典列表中只有1个项目的列表
| 归档时间: |
|
| 查看次数: |
221 次 |
| 最近记录: |