mirror of
https://gitee.com/coder-xiaomo/gitee2github
synced 2025-09-11 14:31:40 +08:00
单一py文件拆分为py文件模块,功能完成
This commit is contained in:
13
assets/common.py
Normal file
13
assets/common.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
def saveJSON(data, filename):
|
||||
with open(filename, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, ensure_ascii=False, indent=4)
|
||||
|
||||
def readJSON(filename):
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
return json.load(f)
|
||||
|
||||
def fileExists(filename):
|
||||
return os.path.exists(filename)
|
Reference in New Issue
Block a user