R
R
Ruslan Mordovanech2021-12-21 11:48:28
Python
Ruslan Mordovanech, 2021-12-21 11:48:28

After I found a Json match, how do I remove it?

with open("file1.json", "r") as f1:
    file1 = json.loads(f1.read())
with open("file2.json", "r") as f2:
    file2 = json.loads(f2.read())

for item in file2:
    if item in file1:
        print(f"Found : {item}")


If it finds data in file1 that is in file2, then delete this data in file1.
How to write it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
Feor_slen, 2021-12-21
@Hery1

file1.clear - will clear your variable from the data taken from the file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question