Skip to content

Instantly share code, notes, and snippets.

@fnielsen
Created July 10, 2013 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fnielsen/5968728 to your computer and use it in GitHub Desktop.
Save fnielsen/5968728 to your computer and use it in GitHub Desktop.
Python interactive command-line interface to Python with coloring of '5'
import blessings, re, readline, rlcompleter
readline.parse_and_bind("tab: complete") # For tab completion
_term = blessings.Terminal() # For coloring text output
while True:
expr = raw_input(">>> ")
try:
_ = eval(expr)
print(re.sub('5', _term.bold_red_on_green('5'), str(_),
flags=re.UNICODE))
except:
exec(expr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment