擅长:python、mysql、java
<p>您可以按如下方式解包键value(元组):</p>
<pre><code>for key, value in d.items():
print (key)
print (value)
</code></pre>
<p>这对python 2和3都有效。</p>
<p>来自<a href="https://docs.python.org/3/library/stdtypes.html#dict.items" rel="nofollow noreferrer">docs</a>:</p>
<blockquote>
<p>Return a new view of the dictionary’s items ((key, value)
pairs).</p>
</blockquote>