spaceningui/subfiles/savetools.py

23 lines
567 B
Python

import json
def check():
print("Save Check Good")
# Yea I know this is pretty pointless in a seperate file but it's nice to have these things
def loadFile(self, file1):
with open(file1, "r") as file:
data = json.load(file)
return data
#Data should be recived in [[data, position], [data, position]] format
def saveFile(self, fileP, data):
with open(fileP, 'r') as file:
data = json.load(file)
for subData in data:
data[subData[1]] = subData[0]
with open(fileP, 'w'):
json.dump(file, indent=2)