码迷,mamicode.com
首页 > 编程语言 > 详细

python two-dimensional array assignment initialize

时间:2015-12-20 12:57:18      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:

#if you want to initialize a 9*9 two-dimensional array 

[([""]*9) for i in range(9)]



#caution:  the follow code can‘t work 
[[""]*9]*9

shallow copies of list concatenated 

if you change one row then the prefix row will also be changed

 

python two-dimensional array assignment initialize

标签:

原文地址:http://www.cnblogs.com/allenhaozi/p/5060501.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!