[Tutor] Finding Match in nexted tuple

Roger Merchberger zmerch at 30below.com
Wed Apr 21 19:32:33 EDT 2004


At 02:44 PM 4/21/2004 -0800, Tim Johnson wrote:
>Let's say I have a list of zip codes returned from a MySQLdb query
>zip_code_list = (('84536',), ('85003',), ('85004',), ('85006',),
>                  ('85007',), ('85008',))
># and I want to look for a match for a value like '85004'
># I can think of doing it like this: (untested)

Maybe I'm being a blasphemer here, but why not put the zipcode in as part 
of your MySQLdb query?

At least for me, knowing more about how you're getting your dataset from 
MySQL would help me more on how to better answer your question.

Laterz,
Roger "Merch" Merchberger

--
Roger "Merch" Merchberger   | "Bugs of a feather flock together."
sysadmin, Iceberg Computers |           Russell Nelson
zmerch at 30below.com          |




More information about the Tutor mailing list