home changes contents help options

109:配列の要素の順序を逆転する

http://pleac.sourceforge.net/pleac_python/arrays.html

reverse()メソッドを使います。

 >>> array = ['banana', 'loganberry', 'passion fruit']
 >>> array.reverse()
 >>> array
 ['passion fruit', 'loganberry', 'banana'] 

 >>> revarray=array[::-1]
 >>> revarray
 ['passion fruit', 'loganberry', 'banana']