Problem with regexp and text injection

Panagiotis Atmatzidis p.atmatzidis at
Mon Oct 22 00:22:56 CEST 2007


I want to create a script in python that search for .html files in the
predefined directory and subdirectories. Then it checks if a specific
snippet of code exists in the .html file, if not it injects/adds the
code right below the string <body> otherwise bypasses the file.

I wrote the first part, I managed to write search function and I'm
trying to find my way out of regular expressions reading the manuals.
However I don't know what kind of function and module to use in order
to write this function,, re.string() or re.match() or
maybe re.compile() ?

I have not much programming experience. Programming is not my cup of

Can someone help by pointing me to a sample code with comments if



More information about the Python-list mailing list