[Tutor] Return key from value

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri May 14 16:14:07 EDT 2004



On Fri, 14 May 2004, firephreek wrote:

> I thought about duplicating my dictionary set (which will hold k/v to
> match vend/# to vend/name so I can search against both.  But because the
> set is going to be pretty big (I'll need to cross match item# vs.
> item/name) I was looking for the most efficient route, the other option
> that occurred is to do a sql query against whatever attribute is
> entered, and that may be the route I go with.  We have our own MySQL
> server (love! Like python!), is it very different from sqlite?


Ah, you have MySQL set up already?  Thnk it might be easiest to start with
that.  There's a nice 'MySQLdb' Python module that you can use:

    http://sourceforge.net/projects/mysql-python

So you may not need to maintain a dictionary: you can probably just use
SQL to handle the data processing for you.


Good luck to you!





More information about the Tutor mailing list