Skip to main content
Post Closed as "Duplicate" by Wooble, Makoto, Eric Brown, Josiah Hester, Cfreak

I have the following situation:

data = {'key1' : 'value1', 'key2': [ {'subkey1': 'subvalue1', 'subkey2': 'subvalue2'}, {other dictionaries} ... ] } 

I have the exact dictionary:

{'subkey1': 'subvalue1', 'subkey2': 'subvalue2'} 

stored in a variable. I would like to remove it from the data dict. How could I do this?

I have the following situation:

data = {'key1' : 'value1', 'key2': [ {'subkey1': 'subvalue1', 'subkey2': 'subvalue2'}, {other dictionaries} ... ] } 

I have the exact dictionary:

{'subkey1': 'subvalue1', 'subkey2': 'subvalue2'} 

stored in a variable. I would like to remove it from dict. How could I do this?

I have the following situation:

data = {'key1' : 'value1', 'key2': [ {'subkey1': 'subvalue1', 'subkey2': 'subvalue2'}, {other dictionaries} ... ] } 

I have the exact dictionary:

{'subkey1': 'subvalue1', 'subkey2': 'subvalue2'} 

stored in a variable. I would like to remove it from the data dict. How could I do this?

Source Link
user2525799
user2525799

Python: Deeply nested dictionary editing

I have the following situation:

data = {'key1' : 'value1', 'key2': [ {'subkey1': 'subvalue1', 'subkey2': 'subvalue2'}, {other dictionaries} ... ] } 

I have the exact dictionary:

{'subkey1': 'subvalue1', 'subkey2': 'subvalue2'} 

stored in a variable. I would like to remove it from dict. How could I do this?