擅长:python、mysql、java
<p>您可以使用<a href="http://docs.python.org/2/library/functions.html#any" rel="nofollow">^{<cd1>}</a>函数和<code>in</code>运算符来检查字典中是否存在键。你知道吗</p>
<pre><code>for choice in choices:
for key in my_dict:
if any(choice in my_dict[key][key1] for key1 in my_dict[key]):
print "{} is there".format(choice)
</code></pre>
<p><strong>输出</strong></p>
<pre><code>LV.ip is there
</code></pre>