/
Leonard1L
/
Common_Lfirst_gamecode
Обзор
Документация
Войти
/
Leonard1L
/
Common_Lfirst_gamecode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
DATA_changes.py
26 строк
663 B
Leonard-1L
The game has been redesigned.
06 фев 2024, 19:53
06 фев 2024, 19:53
04bbff2
Код
Авторство
О чём код?
import json users_file = "Users_DATA.json" def load_world(): with open('WORLD.json', "r", encoding="utf-8") as file: world = json.load(file) return world def load_users_data(): try: with open(users_file, "r", encoding="utf-8") as file: users_data = json.load(file) return users_data except json.decoder.JSONDecodeError: return {} except FileNotFoundError: with open(users_file, 'w') as json_file: return json_file.write("{}") def savefile(data): with open(users_file, "w", encoding="utf-8") as file: json.dump(data, file, indent=3, ensure_ascii=False)