From 744ce2666c6f280e3f97529c5e12a4f34b9f84af Mon Sep 17 00:00:00 2001 From: none Date: Mon, 29 Jan 2024 20:53:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BA=D0=B0=D0=B7=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db.py b/db.py index 972533b..92630b3 100644 --- a/db.py +++ b/db.py @@ -9,12 +9,12 @@ if not os.path.exists('db.json'): print('Created new db.json') -def read_db(): - with open("db.json", "r", encoding="utf-8") as openfile: +def read_db(file = 'db.json'): + with open(file, "r", encoding="utf-8") as openfile: db = json.load(openfile) return db -def write_db(db): +def write_db(db, file = 'db.json'): js = json.dumps(db, indent=2, ensure_ascii=False) - with open("db.json", "w", encoding="utf-8") as outfile: + with open(file, "w", encoding="utf-8") as outfile: outfile.write(js)