I have 2 similar json files like below with the same keys. I need to find the difference of only one key in both the files (id_number) and store the name if there is a difference. Is there any way to do that?
[
{
"id_number": "SA4784",
"name": "Mark",
"birthdate": None
},
{
"id_number": "V410Z8",
"name": "Vincent",
"birthdate": "15/02/1989"
},
{
"id_number": "CZ1094",
"name": "Paul",
"birthdate": "27/09/1994"
}
]
set(x.keys()) ^ set(y.keys())
something like that it will eliminate you the different key
Load the two files into dicts, step through them with a loop and on each iteration compare the id_number of each. If they're different, output the name field.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.