Changing HTML file Question

Brett Irving balgorg at hotmail.com
Wed May 14 05:31:02 EDT 2003


Ok I have been trying to use the re subn however it wont run and keeps
coming up with:

 File "getinput.cgi", line 72, in ?
    DisplayForm()
 File "getinput.cgi", line 22, in DisplayForm
    Display(FormInput)
 File "getinput.cgi", line 48, in Display
    Content,TemplateInput)
 File "/usr/local/lib/python2.2/sre.py", line 151, in subn
    return _compile(pattern, 0).subn(repl, string, count)
 File "/usr/local/lib/python2.2/sre.py", line 229, in _compile
    raise error, v # invalid expression
sre_constants.error: multiple repeat

I have a function Display(content) which takes in a form from a
function DisplayForm() as a string and which attempts to replace
everything that was in that form into a template.html file using:

SubResult = re.subn("<!-- *** INSERT CONTENT HERE *** -->",
        Content,TemplateInput)  

( I want to change the file where it says INSERT CONTENT HERE)

Can anyone help.


If there is a better way to replace details within a html file using
python that isnt embedded in the code could someone tell me




More information about the Python-list mailing list