translate txt into HTML

Peter Hansen peter at engcorp.com
Tue Jan 21 21:48:14 EST 2003


Bengt Richter wrote:
> 
> On Tue, 21 Jan 2003 18:11:18 GMT, Mike Meyer <mwm at mired.org> wrote:
> >You've got a bug. Try this for the second print:
> >
> >print >>htmlFile, '<body><pre>%s</pre></body></html>' % text.replace('<', '<')
> >
> I think you have a bug too ;-)
> 
> print >>htmlFile, '<body><pre>%s</pre></body></html>' % \
>                         text.replace('&','&').text.replace('<', '<')

Ouch... text.replace().text.replace() isn't going to get far.  ;-)

Anyway, Martin hit the nail on the head when he clarified that
this is not a bug, depending on the requirements.  Not all 
source files can have such characters within, and the OP 
didn't specify enough detail for us even to be considering my
version a possibility.... no point debugging a "spike" which
isn't intended for use, is there?

-op-op-where-are-you-ly yr's, 
 Peter




More information about the Python-list mailing list