arrData= [
{"name":"小明","age":18},
{"name":"小张","age":10},
{"name":"小明","age":18},
]
查找,name为小明, age为18,有几个,也许会有多个条件,所以要用for
下面写法错误
def search_field(arr, **kwargs):#
def iterator_obj(obj):
result = False
for i in kwargs:
if obj[i] == kwargs[i]:
result = True
return result
return filter(iterator_obj, arr)
search_field(arrData, {'name':"小明",'age':18})
请教正确写法