'How to get only keys of changed dictionary items from dictdiffer?
first = {
"title": "hello",
"fork_count": 20,
"stargazers": ["/users/20", "/users/30"],
"settings": {
"assignees": [100, 101, 201],
}
}
second = {
"title": "hellooo",
"fork_count": 20,
"stargazers": ["/users/20", "/users/30", "/users/40"],
"settings": {
"assignees": [100, 101, 202],
}
}
I run
a = list(diff for diff in list(difer.diff(first, second)))
which returns:
[('change', 'title', ('hello', 'hellooo')), ('add', 'stargazers', [(2, '/users/40')]), ('change', ['settings', 'assignees', 2], (201, 202))]
How do I get only the keys of the dict that were changed? It would be simple with a[1] in for loop but the settings key won't work that way
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
