-1
表達我的新Python和不理解下面的表達式瞭解在Python
tasks = [
{
'id': 1,
'title': u'Buy groceries',
'description': u'Milk, Cheese, Pizza, Fruit, Tylenol',
'done': False
},
{
'id': 2,
'title': u'Learn Python',
'description': u'Need to find a good Python tutorial on the web',
'done': False
}
]
然後
task = filter(lambda t: t['id'] == task_id, tasks)
if len(task) == 0:
abort(404)
return jsonify({ 'task': task[0] })
我不完全理解的代碼的filter(lambda t:t['id']==task_id,tasks)
部分。任何人都可以幫助我嗎?
你能否指點我們[過濾器()的文檔](http://docs.python.org/3.3/library/functions.html#filter)你不理解的地方? –