deepdiff
deepdiff copied to clipboard
not bug, but need help
This is not a bug
I want to know the key.
diff = deepdiff.DeepDiff(reverse_dict, paid_dict,verbose_level=1, view='tree')
print((diff.keys())
dict_keys(['type_changes', 'dictionary_item_removed', 'values_changed', 'dictionary_item_added'])
item = diff["values_changed"][0]
print(item)
"<root['admin_fee'] t1:'-0.0', t2:'0.0'>"
now how to get the item key i.e 'admin_fee'
item.__dict__
{'t1': '-0.0',
't2': '0.0',
'down': None,
'up': <root t1:{'admin_fee'...}, t2:{'accumulate...}>,
'report_type': 'values_changed',
'additional': {},
't1_child_rel': None,
't2_child_rel': None,
'_path': {},
'verbose_level': 1}
Do you mean item.keys() ?
Sep Dehpour
On May 23, 2022, at 7:14 PM, Santhosh Kumar @.***> wrote:
This is not a bug
I want to know how to know the key
diff = deepdiff.DeepDiff(reverse_dict, paid_dict,verbose_level=1, view='tree') print((diff.keys()) dict_keys(['type_changes', 'dictionary_item_removed', 'values_changed', 'dictionary_item_added']) item = diff["values_changed"][0] now how to get the items key
item.dict {'t1': '-0.0', 't2': '0.0', 'down': None, 'up': <root t1:{'admin_fee'...}, t2:{'accumulate...}>, 'report_type': 'values_changed', 'additional': {}, 't1_child_rel': None, 't2_child_rel': None, '_path': {}, 'verbose_level': 1} — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.
here
item = diff["values_changed"][0]
print(item) "<root['admin_fee'] t1:'-0.0', t2:'0.0'>"
print(item.key)
should print admin_fee
For getting the key, please take a look at path() function in https://zepworks.com/deepdiff/current/view.html#tree-view
Sep Dehpour
On May 23, 2022, at 8:48 PM, Santhosh Kumar @.***> wrote:
here
item = diff["values_changed"][0]
print(item) "<root['admin_fee'] t1:'-0.0', t2:'0.0'>"
print(item.key) should print admin_fee
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.