Skip to content Skip to sidebar Skip to footer

Adding Colors In Python Interpreter Prompt, Does Not Wrap Properly

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

Solution 1:

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.


Solution 2:


Post a Comment for "Adding Colors In Python Interpreter Prompt, Does Not Wrap Properly"