I am new to programming in Python and I am just wondering if I could have some help.
I am trying to write a program which creates diary entries for events and I am currently trying to convert the raw_input from the user into a date (yyyy/mm/dd) and time (24hr hh:mm). I have tried looking around for a solution but nothing I do seems to work.
I am also trying to append each event to file and display them on separate lines when they are loaded from the file.
Here is my code up to now:
import cPickle def print_menu(): print '1. Add an Event' print '2. Save Events to File' print '3. Load Events from File' print '4. Quit' print event_list =  menu_choice = 0 print_menu() while True: menu_choice = input("Select Menu Item (1-4): ") if menu_choice == 1: print "Add Event" date = input("Date: ") time = raw_input("Time: ") title = raw_input("Title: ") desc = raw_input("Description: ") loc = raw_input("Location: ") attend = raw_input("Attendee(s): ") ui = "Date: " + date, "Time: " + time, "Title: " + title, "Description: " + desc, "Location: " + loc, "Attendee(s): " + attend event_list.append(ui) elif menu_choice == 2: filename = raw_input("Filename to save: ") pickle_file = open(filename, "w") cPickle.dump(event_list, pickle_file) pickle_file.close() elif menu_choice == 3: filename = raw_input("Filename to load: ") pickle_file = open(filename, "r") events = cPickle.load(pickle_file) pickle_file.close() print "Events:", events elif menu_choice == 4: break else: print_menu() print "Goodbye"
Any help would be greatly appreciated!
Edited by vegaseat: added codetags