Python: Create a duplicate of an array
Posted
by Dan
on Stack Overflow
See other posts from Stack Overflow
or by Dan
Published on 2010-03-16T05:34:56Z
Indexed on
2010/03/16
5:36 UTC
Read the original article
Hit count: 501
I have an double array
alist[1][1]=-1
alist2=[]
for x in xrange(10):
alist2.append(alist[x])
alist2[1][1]=15
print alist[1][1]
and I get 15. Clearly I'm passing a pointer rather than an actual variable... Is there an easy way to make a seperate double array (no shared pointers) without having to do a double for loop?
Thanks, Dan
© Stack Overflow or respective owner