[Tutor] need advice about a dictionary ({})
Richard D. Moores
rdmoores at gmail.com
Sun Sep 11 03:35:33 CEST 2011
On Sat, Sep 10, 2011 at 15:15, Jack Trades <jacktradespublic at gmail.com> wrote:
> On Sat, Sep 10, 2011 at 4:36 PM, Richard D. Moores <rdmoores at gmail.com>
> wrote:
>>
>> Your idea doesn't seem efficient for me --
>> lots of typing and editing.
>
> Not sure what you mean by that? I've updated the gist with a quick 5min
> implementation of a GUI using Tkinter and the approach I outlined. I think
> using a GUI is best way to minimize "typing and editing" in an app like
> this. You can find it here:
>
> https://gist.github.com/1208786#file_book.py
Using Python 2.7 for it, it seems to work fine, except that I can't
see how the GUI helps. It opens only when I use the g option to find
an entry already made. Useful for editing an entry, though.
As for the non-GUI script, I get this error no matter which choice I
make. I'm too dumb, and have forgotten too much of Python 2.x to
debug:
==============================
What's next:
(q) Quit
(a) Add new Entry
(v) View all Entries
(s) General Search
(si) Search by Initials
(sn) Search by Name
> q
Traceback (most recent call last):
File "c:\P32Working\Pickles\nicks_simple_phone_book_app.py", line
171, in <module>
main_loop()
File "c:\P32Working\Pickles\nicks_simple_phone_book_app.py", line
94, in main_loop
> """)
File "<string>", line 1, in <module>
NameError: name 'q' is not defined
Process terminated with an exit code of 1
============================
>
> If you're talking about re-entering all your data from your file, you would
> write a script to do that.
Ha! I would?
> This program assumes that you are starting from
> scratch with a blank phone book. If you would like help converting your
> existing file, I'm sure I or others can help, but I'd need to see the
> original file.
I'll take you up on that. I'll have to edit it some first.
What I have now with "grepping" that 786-line RTF file is maximum
flexibility. A line in the file always begins with a name, with at
least one phone number, then if a company, the hours they are
reachable by phone, possibly their web address, maybe an email
address, my contact there plus maybe her secretary. If a physician,
there might very well be his specialty, his nurse's name, mention of
who recommended him to me, etc. It seems that the format of info for
your way is set rigidly in advance, or am I wrong?
Dick
>
> --
> Nick Zarczynski
> Pointless Programming Blog
>
>
More information about the Tutor
mailing list