Created
April 16, 2018 21:28
-
-
Save ansakoy/71850d9fa8c279fe063990b92d764e6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
def load_json(source): | |
with open(source, 'r') as handler: | |
return json.load(handler) | |
def load_utf_json(source): | |
with open(source, 'r', encoding="utf8") as handler: | |
return json.load(handler) | |
def dump_json(dictionary, json_file): | |
# Записать словарь в виде файла json | |
with open(json_file, 'w', encoding='utf-8') as handler: | |
json.dump(dictionary, handler, ensure_ascii=False, sort_keys=True, indent=2) | |
def prettify_json(source, outname): | |
initial = load_json(source) | |
dump_json(initial, outname) | |
print('DONE') | |
if __name__ == '__main__': | |
source = r"egrul_status.json" | |
output = r"egrul_status.json" | |
prettify_json(source, output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment