translate txt into HTML

Bengt Richter bokr at oz.net
Thu Jan 23 22:49:20 CET 2003


On Tue, 21 Jan 2003 21:48:14 -0500, Peter Hansen <peter at engcorp.com> wrote:

>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('<', '&lt;')
>> >
>> I think you have a bug too ;-)
>> 
>> print >>htmlFile, '<body><pre>%s</pre></body></html>' % \
>>                         text.replace('&','&amp;').text.replace('<', '&lt;')
>
>Ouch... text.replace().text.replace() isn't going to get far.  ;-)
Oops. Gored on the horns of my own smugness ;-/
And besides, I should have read Martin's post before posting anything,
since mine wasn't even an adequate me-too *<8^p

>
>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

Regards,
Bengt Richter




More information about the Python-list mailing list