Wildcard for string replacement?!?!

Grzegorz Adam Hankiewicz gradha at titanium.sabren.com
Mon Mar 10 15:41:43 EST 2003


On Mon, Mar 10, 2003 at 09:13:32PM +0200, Perverted Orc wrote:
> Hello everyone!
> I 'm working for over a week on this script but I can't make my
> way out. The whole idea is to replace (better say delete) anything
> that stands between the <td> and</td> tag of an html file.

Hmmm... I think you could load the whole html file as a single
string, and use a multiline case insensitive regular expression (see
re module documentation) with an expression like r'<td>.*?</td>'
to detect the parts you don't want and substitute with ''.

-- 
 Please don't send me private copies of your public answers. Thanks.





More information about the Python-list mailing list