擅长:python、mysql、java
<p>使用map也可以:</p>
<pre><code>firstnames = map(list, firstnames.items())
</code></pre>
<p>请注意,在python3中,这将构建一个生成器(因此,正如Willem comment所说,最好在map调用周围使用<code>list()</code>,以便在调用时获取值)。你知道吗</p>
<pre><code>firstnames = list(map(list, firstnames.items()))
</code></pre>