擅长:python、mysql、java
<pre><code>>>> a= [1,2,3,4,5,6,7,8,9,10]
>>> a[::-1]
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
>>> reversed(a)
<listreverseiterator object at 0x10dbf5390>
</code></pre>
<p>第一种表示法是急切地生成反向;第二种表示法是给您一个反向迭代器,这可能更便宜,因为它有可能只在需要时生成元素</p>