首页 > 编程语言 > 详细

python multi array

时间:2014-09-01 12:03:53      阅读:356      评论:0      收藏:0      [点我收藏+]

‘‘‘
Created on 2014-8-29

@author: hg
‘‘‘
#http://www.cnblogs.com/btchenguang/archive/2012/01/30/2332479.html

myList =  [[0] * 3] * 4

myList[0][1] = myList[0][1] +2
print ‘shallow copy: ‘
for i in range(0,4):
    for j in range(0,3):
        print str(myList[i][j]),"\t",
    print
print   
myList =  [([0] * 3) for i in range(4)]

myList[0][1] = myList[0][1] +2
print ‘not shallow copy: ‘
for i in range(0,4):
    for j in range(0,3):
        print str(myList[i][j]),"\t",
    print
print   

python multi array

原文:http://www.cnblogs.com/huiwq1990/p/3948781.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!