flwkjlwekjfs

Untitled

Jun 29th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #!/usr/bin/python3.6
  2.  
  3. import json
  4.  
  5. # import old json
  6. with open("1.json") as foo:
  7. data = json.load(foo)
  8.  
  9. # copy contents to new list of dicts
  10. new_list = []
  11. for thing in data:
  12. new_list.append(thing)
  13.  
  14. # export new list of dicts to json
  15. with open("2.json", 'w') as bar:
  16. json.dump(new_list, bar)
Add Comment
Please, Sign In to add comment