![]() |
Problem with Dictionary Copies - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1) +--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3) +--- Thread: Problem with Dictionary Copies (/showthread.php?tid=88329) |
Problem with Dictionary Copies - leusiam - 08-23-2023 Hello there, I'm new to this and trying to make a clone of a dictionary so that I may make changes without harming the original, as I learnt from scaler's post. However, even after making the copy, the modifications I make appear to have an effect on both the copy and the original dictionary. This is my code: Code: original_dict = {'x': 1, 'y': 2, 'z': 3} Surprisingly, both dictionaries exhibit the same 'x' value. I thought I'd made a separate duplicate, but it appears that modifications to one are affecting the other. How can I actually make a duplicate of the dictionary? RE: Problem with Dictionary Copies - ozornick - 08-23-2023 Forum PHP for programmers) There may be no answer |