seed wildcards

This commit is contained in:
lilly
2023-03-25 02:53:15 +09:00
parent 5de0819c15
commit 4596db540c
4 changed files with 35 additions and 30 deletions
+1 -23
View File
@@ -1,13 +1,11 @@
import sys
import json
import ast
import os
if __name__ == os.path.splitext(os.path.basename(__file__))[0] :
from ConsoleColor import print, console
else:
from .ConsoleColor import print, console
#print(__file__)
#print(os.path.basename(__file__))
"""
import psutil
@@ -47,23 +45,3 @@ mainFile = os.path.abspath(sys.modules['__main__'].__file__)
print("os.path.abspath(sys.modules\['__main__'].__file__) : " + mainFile ,style="bold CYAN")
mainfolder = os.path.dirname(mainFile)
print("os.path.dirname(mainFile) : " + mainfolder , style="bold CYAN")
def jsondic(full,dic,update=False):
path=os.path.split(full)[0]
if not os.path.exists(path):
os.makedirs(path)
#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:
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)
return path