2014年1月20日 星期一

Python 二維陣列

Python 二維陣列

可使用list=[list1,list2]的方式宣告
取值的方式為list[index1][index2]

ex.
>>> list2d=[[1,2],[3,4]]
>>> list2d
[[1, 2], [3, 4]]
>>> list2d[0][0]
1
>>> list2d[1][0]
3

沒有留言:

張貼留言