1 changed files with 9 additions and 0 deletions
@ -1,10 +1,19 @@ |
|||||
import json |
import json |
||||
import sys |
import sys |
||||
|
import datetime |
||||
|
|
||||
|
|
||||
def load_json_file(filepath: str) -> any: |
def load_json_file(filepath: str) -> any: |
||||
with open(filepath, "r") as f: |
with open(filepath, "r") as f: |
||||
return json.load(f) |
return json.load(f) |
||||
|
|
||||
|
def save_string_as_file(content: str, filepath: str = None) -> None: |
||||
|
if filepath == None: |
||||
|
filepath = "temp_" + datetime.datetime.now().strftime("%Y%m%d_%H%M%S") + ".txt" |
||||
|
|
||||
|
with open(filepath, "w") as f: |
||||
|
f.write(content) |
||||
|
|
||||
|
|
||||
|
|
||||
def print_error(*args, **kwargs): |
def print_error(*args, **kwargs): |
||||
|
Loading…
Reference in new issue