Nah_kagz1092
commited on
Create data.py
Browse files
data.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
|
| 3 |
+
def load_data(file_path):
|
| 4 |
+
with open(file_path, 'r', encoding='utf-8') as file:
|
| 5 |
+
data = json.load(file)
|
| 6 |
+
return data
|
| 7 |
+
|
| 8 |
+
def save_data(data, file_path):
|
| 9 |
+
with open(file_path, 'w', encoding='utf-8') as file:
|
| 10 |
+
json.dump(data, file, ensure_ascii=False, indent=4)
|