I have the following problem in python:
I get a json from a list with 4 objects. I'm going to remove the last object from this list and assign it to 2 different variables. In the first variable I will add an object at the end of the list and in the second variable I will add another different object at the end of the list. The problem is that when I remove the last object from the first list, it is also removed from the second. How do I resolve this? I'm using the json below as an example.
test = [
{'test': 'test1'
},
{'test': 'test2'
},
{'test': 'test3'
},
{'test': 'test4'
}
]
block1 = test
block2 = test
print(block2)
block1.pop(3)
print(block2)
Output:
[{'test': 'test21'}, {'test': 'test2'}, {'test': 'test3'}, {'test': 'test4'}]
[{'test': 'test21'}, {'test': 'test2'}, {'test': 'test3'}]
Thanks.