Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41239 > unrolled thread

Re: editing a HTML file

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2013-03-14 19:18 +0100
Last post2013-03-14 19:18 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Re: editing a HTML file Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-03-14 19:18 +0100

#41239 — Re: editing a HTML file

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2013-03-14 19:18 +0100
SubjectRe: editing a HTML file
Message-ID<mailman.3316.1363285118.2939.python-list@python.org>
----- Original Message -----
> Hi all,
> 
> I'would like to make a script that automatically change some text in
> a
> html file.
> 
> I need to make some changes in the text of <p> tags
> 
> My question is: there is a way to just "update/substitute" the text
> in
> the html <p> tags or do i have to make a new modified copy of the
> html file?
> 
> To be clear, i'ld like to make something like this:
> 
> open html file
> for every <p> tags:
>    if "foo" in text:
>      change "foo" in "bar"
> close html file
> 
> any sample would be really appreciated
> I'm really a beginner as you can see
> 
> Thanks
> --
> http://mail.python.org/mailman/listinfo/python-list
> 

Hi,

You can use
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#modifying-the-tree

Almost all functions have an example.


Cheers,

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web