Created
July 22, 2020 11:44
-
-
Save cccntu/f03ba1c3450e148fe3731a3203e30c2f to your computer and use it in GitHub Desktop.
python utils
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 read_json(path, encoding = 'utf-8'): | |
with open(path, encoding = encoding) as f: | |
return json.load(f) | |
def write_json(data, path, encoding = 'utf-8'): | |
with open(path, 'w', encoding = encoding) as f: | |
return json.dump(data, f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment