>>> python "range" but in reverse
>Just find replace into this:
>tel = {"SPQ": "3[1,0-3]", "SPQ": "70(1-3)" }
this is exactly what I was thinking of and asking about, thx once
again. And, yes, this is me to blame ;)
--
Kuba
On Thu, Jun 25, 2009 at 8:23 AM, Trollkarlen<[email protected]> wrote:
>
> Cleaner one:
>
> Just find replace into this:
> tel = {"SPQ": "3[1,0-3]", "SPQ": "70(1-3)" }
>
> def get_operator(number):
> import re
> for key, value in tel:
> 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
>
>
> On Jun 25, 12:08 am, Kuba Kucharski <[email protected]> wrote:
>> definitely nicer than mine. Thanks.
>>
>> --
>> Kuba
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---