replacing words in HTML file

Luap777@gmail.com luap777 at gmail.com
Wed Apr 28 17:03:00 EDT 2010


On Apr 28, 8:02 am, james_027 <cai.hai... at gmail.com> wrote:
> hi,
>
> Any idea how I can replace words in a html file? Meaning only the
> content will get replace while the html tags, javascript, & css are
> remain untouch.
>
> THanks,
> James

You might try cleaning the HTML with uTidy (http://
utidylib.berlios.de/) to make XHTML then using Beautiful Soup (http://
www.crummy.com/software/BeautifulSoup/documentation.html) to process
it.

If the number of files isn't that large and it's a one-time thing, you
might be just as well using search and replace on the directory and
previewing each replacement as you go....



More information about the Python-list mailing list