I would like to have a more colorful Python prompt in the terminal, just for readability. I currently have:
sys.ps1 = '\033[96m>>> \033[0m'
sys.ps2 = '\033[96m... \033[0m'
in my PYTHONSTARTUP
file, which does give it colors as desired. However, any text over a line does not wrap properly. The text goes to the end of the line, and instead of immediately starting a new line, starts overwriting the beginning of the first line before starting a new line. As you might imagine, this is actually rather unreadable. How can I fix this behavior?
Is there some reason to not use IPython? IPython does provide color prompts, etc. out of the box...
Try the following:
sys.ps1 = '\001\033[96m\002>>> \001\033[0m\002'
sys.ps2 = '\001\033[96m\002... \001\033[0m\002'
This answer to a similar question explains why the \001
and \002
are necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With