python source -> html

Mel Wilson mwilson at the-wire.com
Sat Dec 14 12:26:40 EST 2002


In article <atf0hh$qkv$03$1 at news.t-online.com>,
"Achim Domma" <achim.domma at syynx.de> wrote:
>Hi,
>
>I'm looking for a tool, which converts python source code to html, to show
>examples on a webpage. Any idea?

Easy to write a little filter (Danger -- untested code):

import cgi, sys
sys.stdout.write ('<pre>'>
sys.stdout.write (cgi.escape (sys.stdin.read()))
sys.stdout.write ('</pre>')

        Regards.        Mel.



More information about the Python-list mailing list