Files
data-management/general_function.py
T
2022-08-22 19:24:42 +08:00

23 lines
659 B
Python

import json
from operator import concat
import os
def read_json_file(path, name):
try:
with open(concat(path,name)) as json_file:
output = json.load(json_file)
return output
except Exception as e:
print(e)
print("[FUNCTION_ERROR]-read_json_file:" , name)
return False
def delete_csv_in_path(path):
for folder, subfolders, files in os.walk(path):
for file in files:
if file.endswith('.csv'):
path = os.path.join(folder, file)
print('deleted : ', path )
os.remove(path)
print("[Delete Temp Complete]",file)