Merge pull request #23 from JackLeeHal/main

add multi-language support for file read
This commit is contained in:
Patilla Code
2023-06-15 21:09:21 +02:00
committed by GitHub

4
db.py
View File

@@ -10,11 +10,11 @@ class DB:
os.makedirs(self.path, exist_ok=True)
def __getitem__(self, key):
with open(self.path / key) as f:
with open(self.path / key, encoding='utf-8') as f:
return f.read()
def __setitem__(self, key, val):
with open(self.path / key, 'w') as f:
with open(self.path / key, 'w', encoding='utf-8') as f:
f.write(val)