擅长:python、mysql、java
<p>您可以使用基本for循环来实现这一点。在每次迭代中,如果<code>car</code>是当前元素,则该元素的类别将通过引用<code>car_categories[car]</code>获得:</p>
<pre class="lang-py prettyprint-override"><code>for car in cars:
print('%d corresponds to %s' % (car, car_categories[car]))
</code></pre>