building a database with python
import json
import os
building a database with python
import json
import os
building a database with python
class FoobarDB(object):
def __init__(self , location):
self.location = os.path.expanduser(location)
self.load(self.location)
def load(self , location):
if os.path.exists(location):
self._load()
else:
self.db = {}
return True
def _load(self):
self.db = json.load(open(self.location , "r"))
def dumpdb(self):
try:
json.dump(self.db , open(self.location, "w+"))
return True
except:
return False
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us