Oh, stupid me forgot the error message. Well, for some odd reason it works now, but there are still some issues. When I tried it just a few minutes ago, it worked fine, it seemed to me. If anyone have any tips, please let me know. Thanks everyone for the tips.
On Tue, Aug 24, 2010 at 2:24 PM, <christopher.h...@allisontransmission.com>wrote: > > > aug dawg <augdaw...@gmail.com> wrote on 08/24/2010 01:55:14 PM: > > > > Now it says that the variable adder is not defined. Does anyone know > about this? > > > It is best if you send the full error message, it helps pinpoint the > problem. > my copy of your code was: > database = [] > datafile = open('/home/~/the-db/data') > for line in datafile: > database.append(line) > > while tf2 != True: > command = raw_input("Enter a command. >> ") > > while tf != True: > if "add" in command: > adder = raw_input("What to add? >> ") > data_base.append(adder) > if "no more" in adder: > tf = True > > if "read" in command: > print(database) > if "search" in command: > searcher = raw_input("Enter term to search >> ") > if searcher in database: > # Figure this out. > if "exit database" in command: > print "Bye!" > sys.exit() > > I am not sure what you typed in as your command or how your source was > formatted (the tabs did not come through to me) so I cannot say for sure. > If "add" was not your command, adder does not get defined. > My guess is that you typed in a different command so you skipped the > assignment but are checking for "no more" in adder, or attempting to append > adder. This would trigger that error. Did you get the "What to add? >>" > message? > > Chris
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor