Skip to main content
added 88 characters in body
Source Link
Toff'
  • 489
  • 4
  • 10

If you don't know the matching key (here 'key2'), you can use:

exact_dict = {'subkey1': 'subvalue1', 'subkey2': 'subvalue2'} for val in data.itervalues(): try: if exact_dict in val: val.remove(exact_dict) except TypeError: pass 

If you don't know the matching key (here 'key2'), you can use:

for val in data.itervalues(): try: if exact_dict in val: val.remove(exact_dict) except TypeError: pass 

If you don't know the matching key (here 'key2'), you can use:

exact_dict = {'subkey1': 'subvalue1', 'subkey2': 'subvalue2'} for val in data.itervalues(): try: if exact_dict in val: val.remove(exact_dict) except TypeError: pass 
Source Link
Toff'
  • 489
  • 4
  • 10

If you don't know the matching key (here 'key2'), you can use:

for val in data.itervalues(): try: if exact_dict in val: val.remove(exact_dict) except TypeError: pass