I am using the deepdiff
function to find the difference between 2 dictionaries, which gives the output as: A = {'dictionary_item_added': set(["root['mismatched_element']"])}
. How to print just 'mismatched_element'
?
Try this:
set_item = A['dictionary_item_added'].pop()
print set_item[set_item.find("['")+2 : set_item.find("']")]
The first line gets the element from the set, the second removes the []
and everything around them, and prints.
This code does the specific task you asked for, but it's hard to generalize the solution without a more generalized question..