Re: replacing words in HTML file

2010-04-30 Thread Walter Dörwald
On 28.04.10 15:02, james_027 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. You could try XIST (http://www.livinglogic.de/Python/xist/): Example code: from ll.xist import

Re: replacing words in HTML file

2010-04-29 Thread Cameron Simpson
On 30Apr2010 07:15, Stefan Behnel wrote: | Cameron Simpson, 30.04.2010 00:47: | >Here's a function from a script I wrote to bulk edit a web site. I was | >replacing OBJECT and EMBED nodes with modern versions: | > | > def recurse(node): | > global didmod | > [...] | > didmod=Tr

Re: replacing words in HTML file

2010-04-29 Thread Stefan Behnel
Cameron Simpson, 30.04.2010 00:47: Here's a function from a script I wrote to bulk edit a web site. I was replacing OBJECT and EMBED nodes with modern versions: def recurse(node): global didmod [...] didmod=True continue recurse(O) > The calling end

Re: replacing words in HTML file

2010-04-29 Thread Cameron Simpson
On 29Apr2010 05:03, james_027 wrote: | On Apr 29, 5:31 am, Cameron Simpson wrote: | > On 28Apr2010 22:03, Daniel Fetchinson wrote: | > | > 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

Re: replacing words in HTML file

2010-04-29 Thread Daniel Fetchinson
>> > | > 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. >> > | >> > | I'm not sure what you tried and what you haven't but as a first trial >> > | you might want to >> > | >> > |

Re: replacing words in HTML file

2010-04-29 Thread Iain King
On Apr 29, 10:38 am, Daniel Fetchinson wrote: > > | > 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. > > | > > | I'm not sure what you tried and what you haven't but as a first tr

Re: replacing words in HTML file

2010-04-29 Thread james_027
On Apr 29, 5:31 am, Cameron Simpson wrote: > On 28Apr2010 22:03, Daniel Fetchinson wrote: > | > 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. > | > | I'm not sure what you tried and

Re: replacing words in HTML file

2010-04-29 Thread Daniel Fetchinson
> | > 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. > | > | I'm not sure what you tried and what you haven't but as a first trial > | you might want to > | > | > | > | f = open( 'new

Re: replacing words in HTML file

2010-04-28 Thread Cameron Simpson
On 28Apr2010 22:03, Daniel Fetchinson wrote: | > 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. | | I'm not sure what you tried and what you haven't but as a first trial | you might want

Re: replacing words in HTML file

2010-04-28 Thread luap...@gmail.com
On Apr 28, 8:02 am, james_027 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

Re: replacing words in HTML file

2010-04-28 Thread Daniel Fetchinson
> 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. I'm not sure what you tried and what you haven't but as a first trial you might want to f = open( 'new.html', 'w' ) f.write( open( 'index.h