All pastes #829001 Raw Edit

Something

public python v1 · immutable
#829001 ·published 2007-12-22 21:33 UTC
rendered paste body
import calendarimport datetimetoday = datetime.date.today()states = {'month':today.month, 'year':today.year, 'day':today.day}events = {}def cmdHandler (cmd):    if (cmd == 'end'):        return ()        print 'File saved you can exit now'    elif (cmd == 'a'):        events = { 'test' : "%d%d" % ( states['year'], states['month'] ) }        print events         elif (cmd == 'p'):        if (states['month'] == 1):            states['month'] = 12            states['year'] = states['year']-1        else:            states['month'] = states['month']-1            displayMonth(states['year'],states['month'])    elif (cmd == 'n'):        if(states['month'] == 12):                states['month'] = 1                states['year'] = states['year']+1        else:            states['month'] = states['month']+1        displayMonth(states['year'],states['month'])    else:        print 'Available commands :\n "a" to add new event\n "p" to get to the previous month\n "n" to get to the next month\n "end" to exit\n'def displayMonth(year , month):    calendar.prmonth(year, month)def main():    print 'My calendar version alpha\n'        displayMonth(today.year, today.month)    print states['year'],states['month']    while True:        cmdHandler(raw_input('Please select a command : \n'))main()