[Tutor] Questions about shelve
Andrei Kulakov
ak@silmarill.org
Tue, 23 Oct 2001 15:29:21 -0400
On Tue, Oct 23, 2001 at 01:18:05PM -0600, Jackson wrote:
> Objective (Please see script below):
> Create simple server outage tracking db. While MySQL
> would be easer to use, it's not as much fun *grin*
>
> Data layout:
> Each record consist of; hostname,date,problem,resolution with
> hostname and date beging key fields, and problem/resolution being multi-line text field.
>
> What's missing:
> 1. Need to be able to enter more than one outage per server, did I read someplace that you can set Btree to allow dup keys?
Why multiple keys? Just make the value a list of outages.
>
> 2. Change "end_of_field" char to Ctrl+a to allow multi line imput for problem and resolution fields.
Look into curses module (fairly complex) or Tkinter.
>
> Thanks for you time.
> David Jackson
>
>
> ------------- Script -----------------------
>
> #!/usr/bin/python
> import shelve
> #
> people = shelve.open("/tmp/btree.db")
> host=raw_input("Enter Hostname: ")
> date=raw_input("Date of Outage: ") problem=raw_input("Problem Descrption: ")
> resolution=raw_input("Problem Resolution: ")
> people[host]=[date,problem,resolution]
> people.close()
>
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org