Replace and inserting strings within .txt files with the use of regex

Νίκος nikos.the.gr33k at gmail.com
Sat Aug 7 20:20:24 EDT 2010


Hello dear Pythoneers,

I have over 500 .php web pages in various subfolders under 'data'
folder that i have to rename to .html and and ditch the '<?' and '?>'
tages from within and also insert a very first line of <!-- id -->
where id must be an identification unique number of every page for
counter tracking purposes. ONly pure html code must be left.

I before find otu Python used php and now iam switching to templates +
python solution so i ahve to change each and every page.

I don't know how to handle such a big data replacing problem and
cannot play with fire because those 500 pages are my cleints pages and
data of those filesjust cannot be messes up.

Can you provide to me a script please that is able of performing an
automatic way of such a page content replacing?

Thanks a million!



More information about the Python-list mailing list