[Tutor] Re: Are you allowed to shoot camels? [kinda OT]
Bill Mill
bill.mill at gmail.com
Thu Feb 3 21:27:32 CET 2005
On Thu, 3 Feb 2005 04:24:06 -0500, Patrick Hall <pathall at gmail.com> wrote:
> > Beware! Overcome the temptation!
> > Try this: http://kodos.sourceforge.net/
>
> While I have no problem personally with Perl or PHP, I'll second the
> recommendation for kodos -- it's very useful for learning to use
> regexes in Python.
Ok, I have to ask: why? Whenever I write and debug regexes (as I had
to do this morning for the first time in a while - I try to avoid
them) I always create a function in the interpreter that looks like:
def test(regex, line):
print re.compile(regex).match(line).groups()
and then test my regexes incrementally:
>>>l = '8 this is my line to test'
>>> test('^\s*(\d)+', l)
until I have it right. How is using this tool easier than that?
Peace
Bill Mill
bill.mill at gmail.com
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list