[Tutor] pattern matching problem
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Thu May 26 21:29:43 CEST 2005
On 26 May 2005 cgw501 at york.ac.uk wrote:
> I have to write a function that will return the index of a line like this:
>
> gvcdgvcgdvagTVTVTVTVTVTHUXHYGSXUHXSU
>
> where it first becomes capital letters. I've had about a hundred
> different ideas of the best way to do this, but always seem to hit a
> fatal flaw.
Hi Chris,
It might be interesting (or amusing) to bring up one of those
fatally-flawed schemes on the Tutor list, so that we know what not to do.
*grin*
In seriousness, your ideas might not be so bad, and one of us here might
be able to point out a way to correct things and make the approach more
reasonable. Show us what you've thought of so far, and that'll help
catalize the discussion.
> Any thoughts?
Have you looked into using a regular expression pattern matcher? A.M.
Kuchling has written a tutorial on regular expressions here:
http://www.amk.ca/python/howto/regex/
Would they be applicable to your program?
More information about the Tutor
mailing list