[Tutor] re module and looping
McCarney, James Alexander
James.Alexander.McCarney@Cognicase.com
Fri, 11 Oct 2002 15:30:47 -0400
Magnus wrote:
"Read the library manual. First of all, read about the
difference between match and search. Then forget that ;)
and use findall instead."
Absolutely brilliant! ;-) Thanks Magnus...
One glitch, however, is this. The code caught everything, except for these
two tags:
<!--
and
-->
Which is where a script goes in the HTML...
I would have thought
p=re.compile(r"(<.*?>)",re.DOTALL)
m=re.findall(r"(<.*?>)",alllines)
would have returned everything, including <!-- and -->
I am reading the re How-to by Andrew Kuchling. Btw, I will read re, reread
re, and re-reread re, because text-processing is a big part of what I need
to do.
Cheers! Who knows, maybe a nice script for the useless Python site.