mirror of
https://github.com/RGBCube/JsonWrapper
synced 2025-07-27 11:47:45 +00:00
db.all()
This commit is contained in:
parent
58850a9c4a
commit
5b9e8796d2
1 changed files with 5 additions and 2 deletions
7
db.py
7
db.py
|
@ -31,12 +31,15 @@ class ClutterDB:
|
|||
else:
|
||||
return None
|
||||
|
||||
def all(self):
|
||||
with open(self.path_to_json, mode="r") as json_file:
|
||||
return json.load(json_file)
|
||||
|
||||
def rem(self, key: str):
|
||||
with open(self.path_to_json, mode="r") as json_file:
|
||||
json_data = json.load(json_file)
|
||||
with open(self.path_to_json, mode="w") as json_file:
|
||||
json_data.pop(key, None)
|
||||
json.dump(json_data, json_file, indent=4)
|
||||
json.dump(json_data.pop(key, None), json_file, indent=4)
|
||||
|
||||
def nuke(self):
|
||||
with open(self.path_to_json, mode="w") as json_file:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue