In general, try copy.copy() or copy.deepcopy() for the general case. Not all objects can be copied, but most can.

import copy

newobj = copy.copy(oldobj) # shallow copy
newobj = copy.deepcopy(oldobj) # deep (recursive) copy

Some objects can be copied more easily. Dictionaries have a copy() method:

newdict = olddict.copy()

Sequences can be copied by slicing:

new_l = l[:]

CATEGORY: programming