Friday, April 29, 2011

python : To create a separate list

To create a separate list, you can use slicing or the list function to quickly create a copy:

L = []
M = L[:] # create a copy

# modify L only
L.append(obj)

No comments:

Post a Comment