I am trying to implement a Doctor's weekly scheduling appointment system. I would like to know how can i use shelve to store my dictionary objects. It would be great if someone can review my code and suggest how I can improve it further. How can i store timeslot dictionary into shelves? (I have appended Monday,Tue,wed,thursday and Friday objects into timeslot dictionary and now im unsure of how can I store these objects in dictionary into shelves.)
class default_timeslots:
def __init__(self,day,time):
self.__day = day
self.__time = time
class Store:
timeslots = {}
def __init__(self):
if len(__class__.timeslots) <= 0:
self.create_default_timeslots()
def create_default_timeslots(self):
Monday = default_timeslots('Mon',time={"8:00","9:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00"})
Tuesday = default_timeslots('Tue',
time={"8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00",
"17:00", "18:00"})
Wednesday = default_timeslots('Wed',
time={"8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00",
"17:00", "18:00"})
Thursday = default_timeslots('Thursday',
time={"8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00",
"17:00", "18:00"})
Friday = default_timeslots('Friday',
time={"8:00", "9:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00",
"17:00", "18:00"})
Store.timeslots[Monday.day] = Monday
Store.timeslots[Tuesday.day] = Tuesday
Store.timeslots[Wednesday.day] = Wednesday
Store.timeslots[Thursday.day] = Thursday
Store.timeslots[Friday.day] = Friday
Disclaimer I am a beginner for python and shelves.
Thanks for helping!