Advertisement
Guest User

Untitled

a guest
Aug 9th, 2024
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import json
  2.  
  3.  
  4. file1=json.load(open("user1.json"))
  5. file2=json.load(open("user2.json"))
  6. merged_file={}
  7. merged_file.update(file1)
  8. merged_file["blocked_communities"]=file1["blocked_communities"]+file2["blocked_communities"]
  9. merged_file["blocked_users"]=file1["blocked_users"]+file2["blocked_users"]
  10. merged_file["followed_communities"]=file1["followed_communities"]+file2["followed_communities"]
  11. merged_file["blocked_instances"]=file1["blocked_instances"]+file2["blocked_instances"]
  12. merged_file["saved_comments"]=file1["saved_comments"]+file2["saved_comments"]
  13.  
  14.  
  15. with open("merged.json", "w") as f:
  16.     json.dump(merged_file, f)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement