23 lines
538 B
Python
23 lines
538 B
Python
import os
|
|
import json
|
|
|
|
|
|
class FS:
|
|
def readJSON(path: str):
|
|
return json.loads((open(path)).read())
|
|
|
|
def writeFile(data, filePath, fileName):
|
|
|
|
file_to_open = filePath + fileName
|
|
|
|
f = open(file_to_open, 'w', )
|
|
|
|
f.write(data)
|
|
def readFile(path:str):
|
|
return open(path).read()
|
|
|
|
def readFilesTypeFolder(pathFolder: str, fileType = '.json'):
|
|
filesJson = list(
|
|
filter(lambda x: x[-fileType.__len__():] == fileType, os.listdir(pathFolder)))
|
|
return filesJson
|
|
|