Nice. A couple of notes though: On Jun 25, 2:23 am, Trollkarlen <[email protected]> wrote: > Cleaner one: > > Just find replace into this: > tel = {"SPQ": "3[1,0-3]", "SPQ": "70(1-3)" }
it only works with square brackets so the second entry, "70(1-3)", will not work. > > def get_operator(number): > import re > for key, value in tel: for key, value in tel.iteritems(): #or tel.items() > if re.match(value, number): > return key > > pre-compile the re before with re.compile and add then to the "tel" > array in stead to get better preformance. > > /R --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

