[Tutor] Python code pretty-print?
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Tue Jan 3 22:29:25 CET 2006
On Tue, 3 Jan 2006, Lance E Sloan wrote:
> A colleague of mine often develops Python code under Mac OS X. He would
> like to be able to print the code in an easily readable format. He's
> found that kwrite on Linux does a very nice job, but it's inconvenient
> to copy his code to a Linux box just to print it out.
>
> We've found mention (mostly in manpages) of a program called
> "pyhtmlizer", but couldn't find source or binary for it.
Hi Lance,
'pyhtmlizer' is in the twisted package, under twisted.scripts:
http://twistedmatrix.com/documents/current/api/twisted.scripts.htmlizer.html
You should be able to get the source there.
Alternatively, the Python Cookbook has a good recipe for syntax
highlighting:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298
Finally, GNU Enscript might be applicable. GNU Enscript knows how to
colorize and pretty print different programming languages, and I believe
it's already in Mac OS X.
http://www.osxfaq.com/man/1/enscript.ws
If you use the --pretty-print, --color, and -Whtml options, you should be
able to get some reasonable output with it.
Best of wishes!
More information about the Tutor
mailing list