If you have a dictionary or map, and you want to split it into two separate dictionaries, you can use the deepcopy
method from the copy
module. Here is an example:
main.py418 chars26 lines
In this example, copy.deepcopy
is used to make a copy of the original map, to ensure that the two resulting maps are completely independent of each other. Then, keys are removed from each map independently.
gistlibby LogSnag