I/O
Peter Scott
sketerpot at chase3000.com
Tue Dec 17 18:25:20 EST 2002
More information about the Python-list mailing list
Tue Dec 17 18:25:20 EST 2002
- Previous message (by thread): SQL Front End?
- Next message (by thread): I/O
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tee Bee wrote: > My first problem at the moment is, that I got a 1 or 2 dozen of HTML-files > with text-passages that need to be changed or deleted. > > f.e.: > > 1. <b>this is a text-passage</b> <= Content of the file. > > 2. read every byte > > 3. compare > > 4. delete or change content That looks like a job for sed or perl. With those you could do "s/<b>this is a text-passage</b>/<b>This is what to replace it with/g" and just run this sed script on all the files you want. The perl syntax is similar. If you really want to use Python, such as if you have this as part of a larger application or want Python's portability, I believe that you could go through all your files and use "string.replace(myString, '<b>this is a text-passage</b>', '<b>This is what to replace it with')" Hopefully those should do the trick. -Peter
- Previous message (by thread): SQL Front End?
- Next message (by thread): I/O
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list