python怎样将元组中的数据倒置

如题所述

第1个回答  2012-02-25
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> t = tuple(range(10))
>>> t
(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
>>> t = tuple(t[::-1])
>>> t
(9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
>>>
相似回答