對象的列表元素我有對象的列表中的Python:查找具有明確的鍵值
accounts = [
{
'id': 1,
'title': 'Example Account 1'
},
{
'id': 2,
'title': 'Gow to get this one?'
},
{
'id': 3,
'title': 'Example Account 3'
},
]
我需要使用id = 2的對象。
當我只知道對象屬性的值時,如何從此列表中選擇適當的對象?
[查找列表中的對象的屬性等於某個值(滿足任何條件)]的可能的重複](http://stackoverflow.com/questions/7125467/find-object-in-list-that-has-attribute -equal-to-some-value-that-meets-any-condi) – 2014-08-27 13:17:46