Advertisement
here2share

# eval_dict.py

Jun 17th, 2024
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. # eval_dict.py
  2.  
  3. original_dict = {'a': 1, 'b': [2, 3], 'c': {'x': 4, 'y': 5}}
  4. copied_dict = eval(str(original_dict))
  5.  
  6. # Modify a nested object in the original dictionary
  7. original_dict['b'].append('***b***')
  8. original_dict['c']['x'] = '***4>>>c/x***'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement