From 32efe3e2d608a0b9cfdb59d97bab089b09d97d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D1=81=D0=B0=D1=87=D1=82=D0=B8=D0=BA?= <51020966+ca4tuk@users.noreply.github.com> Date: Wed, 24 Jan 2024 19:56:16 +0200 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D1=87=D1=82=D0=B5=D0=BD=D0=B8=D0=B8=20/=20TODO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db.py b/db.py index 5074580..fd44b9d 100644 --- a/db.py +++ b/db.py @@ -1,3 +1,4 @@ +# TODO: переделать import os import json @@ -10,10 +11,11 @@ if not os.path.exists('db.json'): def read_db(): - with open('db.json', 'r') as openfile: + with open("db.json", "r", encoding="utf-8") as openfile: db = json.load(openfile) return db + def write_db(db): js = json.dumps(db, indent=2) with open("db.json", "w") as outfile: - outfile.write(js) + outfile.write(js) \ No newline at end of file