data1= [open("lis1.json", 'r')]
data2= [open('list2.json', 'r')]
first_set = set(map(tuple, data1))
second_set = set(map(tuple, data2))
x= (first_set-second_set)
print(x)
I am attempting to view two list and get the data in list 1 that are not in list two. the issue is list one format for both set of data is as below :
data1= ["Jane Doe", 98132]["John Doe", 12345]
or
data1=
[
"jane doe",
98132
][
"john doe",
12345
]
data2=["Jane Doe", 98132]["John drew", 8989]["John drew", 8989]["John drew", 8989]
data2=
[
"jane doe",
98132
][
"john drew",
8989
]
I was expecting
x = [["John Doe", 12345]
I am comparing a list of users vs call logs so it might have duplicate.
in the file I am seeing this in the errors :"Json standard allows only one top-level value"
if I use json(load)
Traceback (most recent call last):
File "/Users/diff.py", line 4, in <module>
data1 = json.load(open("list1.json"))
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 19 (char 18)