[Tutor] Finding Match in nexted tuple

Tim Johnson tim at johnsons-web.com
Wed Apr 21 19:52:16 EDT 2004


* Roger Merchberger <zmerch at 30below.com> [040421 15:39]:
> 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?
 
  :-) You're not being a blasphemer, that's a real world way for that
      particular problem, I should have used a different example...

      My question still stand regardless of whether its from
      mysql or not. What if it were a hard-coded data-structure?

      thanks
      tim

> 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          |
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Tim Johnson <tim at johnsons-web.com>
      http://www.alaska-internet-solutions.com



More information about the Tutor mailing list