擅长:python、mysql、java
<p>我以前在JSON结构中经常遇到这个问题…频繁到几周前我为它编写了一个小库。。。你知道吗</p>
<p><a href="https://github.com/tfulmer1/nkr" rel="nofollow">nested key retriever (nkr)</a></p>
<p>试试发电机,看看它是否能解决你的问题。您应该能够简单地:</p>
<pre><code>for x in products:
if product_id_searching_for in list(nkr.find_nested_key_values(x, 'CategoryID')):
productsInCategory.append(x)
</code></pre>