Created
July 10, 2013 18:17
-
-
Save fnielsen/5968728 to your computer and use it in GitHub Desktop.
Python interactive command-line interface to Python with coloring of '5'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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