Skip to content

Instantly share code, notes, and snippets.

@timtan
Last active December 18, 2015 01:39
Show Gist options
  • Select an option

  • Save timtan/5705233 to your computer and use it in GitHub Desktop.

Select an option

Save timtan/5705233 to your computer and use it in GitHub Desktop.
the skeleton of you AnnNote
class NoteBookDB(object):
def __init__(self):
pass
def create_db(self):
"Create Database here"
pass
def is_db_exists(self):
return False
# Create
def add_book(self, title, content):
"please return the newly created id_"
pass
# Retrieve
def get_book(self, id_):
return None
# Search
def find_books(self, word):
return []
# Update
def update_book(self, id_, title, content):
pass
# List
def list_books(self):
return []
def delete_book(self, id_ ):
pass
if __name__ == '__main__':
notebookDB = NoteBookDB()
if not notebookDB.is_db_exists():
notebookDB.create_db()
notebookDB.add_book('chapter one of english', 'blah blah')
if not notebookDB.find_books('english'):
print 'Strange, you should find out the book'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment