level = 1 # Уровень
music = True # Включена ли музыка
sfx = True # Спецэффекты
import json
config = {
"level": 1,
"music": True,
"sfx": True,
}
# запись
with open("config.json", "w") as f:
json.dump(config, f)
# чтение
with open("config.json") as f:
config = json.load(f)
# использование соответственно в виде словаря
config['level'] = 3