some change logic

This commit is contained in:
lilly
2023-03-23 23:36:13 +09:00
parent 54f2b163d9
commit 5de0819c15
2 changed files with 7 additions and 5 deletions
+6 -3
View File
@@ -48,7 +48,7 @@ print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style=
mainfolder = os.path.dirname(mainFile)
print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN")
def jsondic(full,dic):
def jsondic(full,dic,update=False):
path=os.path.split(full)[0]
if not os.path.exists(path):
@@ -56,8 +56,11 @@ def jsondic(full,dic):
#with open(f"./RandomLoop/chars-{time.strftime('_%Y%m%d_%H%M%S')}.json", 'w', encoding='utf-8') as file:
if os.path.exists(full):
with open(full, 'r', encoding='utf-8') as file:
dic=json.load(file)
#print(dic)
tmp=json.load(file)
if update:
dic.update(tmp)
else:
dic=(tmp)
else:
with open(full, 'w', encoding='utf-8') as file:
json.dump(dic, file, sort_keys=False, indent=4)
+1 -2
View File
@@ -78,8 +78,7 @@ class wildcards:
except Exception as e:
print(f"Error : {match.groups()}" ,Colors.YELLOW)
print(f"Exception : {e}" ,Colors.YELLOW)
console.print_exception()
return ""