Latest web development tutorials

Python 練習實例32

Python 100例 Python 100例

題目:按相反的順序輸出列表的值。

程序分析:無。

程序源代碼:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

a = ['one', 'two', 'three']
for i in a[::-1]:
	print i

以上實例輸出結果為:

three
two
one

Python 100例 Python 100例