refactoring

This commit is contained in:
frankknoll
2022-12-14 11:51:53 +01:00
parent 90890950c1
commit d9fd3a8e2b
2 changed files with 8 additions and 25 deletions

View File

@@ -1,4 +1,5 @@
import os
import json
class IOUtils:
@@ -32,6 +33,12 @@ class IOUtils:
orient = "split",
index = False)
@staticmethod
def saveDictAsJson(dict, file):
IOUtils.ensurePath(file)
with open(file, 'w') as outfile:
json.dump(dict, outfile)
@staticmethod
def ensurePath(file):
directory = os.path.dirname(file)