Python Forum
Deleting value from dictionary.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting value from dictionary.
#2
Do you mean like this?
>>> thedict = {
...     'aaaa': {
...         '123': 'One Two Three',
...         '234': 'Two Three Four'
...     },
...     'bbbb': {
...         '123': 'One Two Three',
...         '456': 'Four five six',
...     }
... }
>>> thedict
{'aaaa': {'123': 'One Two Three', '234': 'Two Three Four'}, 'bbbb': {'123': 'One Two Three', '456': 'Four five six'}}
>>> del thedict['bbbb']['123']
>>> thedict
{'aaaa': {'123': 'One Two Three', '234': 'Two Three Four'}, 'bbbb': {'456': 'Four five six'}}
>>>
Reply


Messages In This Thread
Deleting value from dictionary. - by dbdb12 - May-18-2018, 01:38 AM
RE: Deleting value from dictionary. - by Larz60+ - May-18-2018, 01:48 AM
RE: Deleting value from dictionary. - by dbdb12 - May-18-2018, 02:00 AM
RE: Deleting value from dictionary. - by buran - May-18-2018, 07:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  deleting item from dictionary Skaperen 6 3,167 Feb-20-2019, 01:18 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020