【发布时间】:2014-10-21 02:17:20
【问题描述】:
我在 python 中有一个对象列表:
accounts = [
{
'id': 1,
'title': 'Example Account 1'
},
{
'id': 2,
'title': 'Gow to get this one?'
},
{
'id': 3,
'title': 'Example Account 3'
},
]
我需要获取 id=2 的对象。
当我只知道对象属性的值时,如何从该列表中选择合适的对象?
【问题讨论】:
标签: python python-2.7 types