[Tutor] Databases in Python

aug dawg augdawg09 at gmail.com
Tue Aug 24 18:47:48 CEST 2010


It says that it's on line 25, on the print("Bye!").
Forgot to say that.


On Tue, Aug 24, 2010 at 12:44 PM, aug dawg <augdawg09 at gmail.com> wrote:

> The other day, I wrote a little database just to fiddle around, but when I
> try to run it it says that it has an unexpected indent. From what I can
> tell, it doesn't. Here's the code. I'm using SPE.
>
> 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()
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100824/fa7a0754/attachment-0001.html>


More information about the Tutor mailing list