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 Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesStack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Explore Stack Internal 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