batch pretty (color) print of python code?

Paul McNett p at
Tue Sep 28 01:20:02 CEST 2004

Fernando Perez writes:

> You said linux was OK.  A simple enscript alias works
> wonders:
> planck[python]> which codeprint
> codeprint:       ein Alias fur enscript  -G2rjE --color  !*
> planck[python]> which codeps
> codeps:          ein Alias fur enscript  -G2rjE --color -o
> !*.ps !*; gv !*.ps
> That's what I use for all kinds of source, it does a pretty
> decent job with python (and knows about C, C++, perl,...)

That's great! Thanks for turning me on to that. Here is the 
alias I'm now using:

alias codeps='enscript -G2rjE --color -o -'

This takes input on stdin and sends the output to stdout, so the 
OP can type:

codeps *.py >

and that is pretty close to what the OP wanted (minus 

Paul McNett
Independent Software Consultant

More information about the Python-list mailing list