Can I get coloured output in interactive python shell?
When I open a python shell with python
, can I have a colored output? For example red errors like you are used from IDEs?
>>> 10 * (1/0)
Traceback (most recent call last):
FIle "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
>>>
I both read man python
and python --help
, but didn't find anything regarding colours so I assume that there is nothing by default, but is it achievable anyway?
Use IPython for an enhanced Python interactive shell.
sudo apt-get install ipython # Python 2
sudo apt-get install ipython3 # Python 3
For example:
IPython has other useful features, such as a browser-based interface.