擅长:python、mysql、java
<p>在Python中使用lamda</p>
<pre><code>data = [
{
"id_number": "SA4784",
"name": "Mark",
"birthdate": None
},
{
"id_number": "V410Z8",
"name": "Vincent",
"birthdate": "15/02/1989"
},
{
"id_number": "CZ1094",
"name": "Paul",
"birthdate": "27/09/1994"
}
]
</code></pre>
<p>使用Lambda和filter</p>
<pre><code>print(list(filter(lambda x:x["id_number"]=="CZ1094",data)))
</code></pre>
<p>输出</p>
<pre><code>[{'id_number': 'CZ1094', 'name': 'Paul', 'birthdate': '27/09/1994'}]
</code></pre>