On 25/9/2013 13:42, Rafael Knuth wrote: > Hej there, > > I want to write a simple program (To Do List) that stores the input > data (action items on To Do List). Currently I can only input items > but the program I wrote doesn't store them. > > Can you help? > > Thanks, > > Rafael > > Here's the code I wrote so far: > > print("This is my to do list") > > Monday = input("Monday ") > Tuesday = input("Tuesday ") > Wednesday = input("Wednesday ") > Thursday = input("Thursday ") > Friday = input("Friday ") > Saturday = input("Saturday ") > Sunday = input("Sunday ") > > print("So, here are your plans for:" + > "\nMonday " + Monday + > "\nTuesday " + Tuesday + > "\nWednesday " + Wednesday + > "\nThursday " + Thursday + > "\nFriday " + Friday + > "\nSaturday " + Saturday + > "\nSunday " + Sunday) >
To have data still available next time you run the program, you need to write it to a file. outfile = open("statefile.txt", "w") outfile.write("Monday") outfile.close() Naturally, if you store non-trivial data, you'll have to organize it somehow, so you can parse it when you read it back in. Alternatively, you can use a module like configparser: http://docs.python.org/3.3/library/configparser.html#module-configparser or several other alternatives. -- DaveA _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor