copying a list

lance lance_99_99 at nospam_yahoo.com
Tue Aug 8 11:51:15 EDT 2000


is there an easy way to get a copy of a list instead of a reference to that
list?

for example, the following code prints [[1]] :

a = [1, 2]
b = []
b.append(a)
a.pop()
print b

but i want the code to print [[1, 2]]

is this possible (without writing my own list copy function)?

--lance





More information about the Python-list mailing list