Whats in your $PYTHONSTARTUP$ ?
Randall Hopper
aa8vb at yahoo.com
Thu Mar 29 08:38:27 EST 2001
Paul Magwene:
|
|Other than import statements, what little programming gems do you folks have
|in your startup files? I thought it would be useful to draw on the
|collective knowledge of the Python community. If we get enough good ideas
|it might be worth sticking up on a web page, or even distributing (in the
|demos or Tools section) with a later release.
Just a little fragment to colorize my python prompts. Nowadays, I'm always
on a VT100 color capable terminal (recent xterm, aterm, FreeBSD/Linux
console, etc.).
import sys,os
if os.environ.get( 'TERM' ) in [ 'xterm', 'vt100' ]:
sys.ps1 = '\001\033[0:1;32m\002>>> \001\033[0m\002'
sys.ps2 = '\001\033[0:31m\002... \001\033[0m\002'
Randall
--
Randall Hopper
aa8vb at yahoo.com
More information about the Python-list
mailing list