ScruffyRules

Untitled

Jan 19th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. #Python 3.4
  2. import json, os
  3.  
  4. script_dir = os.path.dirname(__file__)
  5. script_dir += "" if script_dir == "" else os.path.sep
  6.  
  7. data_dir = script_dir + ".." + os.path.sep + "data" + os.path.sep
  8.  
  9. with open(os.path.join(data_dir, "languages.json")) as f:
  10.     data = json.load(f)
  11.  
  12. with open(os.path.join(data_dir, "languages_sorted.json"), "w") as f:
  13.     f.write(json.dumps(data, indent=4, sort_keys=True))
  14.  
  15. print("language.json has been sorted!")
Advertisement
Add Comment
Please, Sign In to add comment