Is it possible to print using different colors in ipython's Notebook?

后端 未结 12 1177
孤独总比滥情好
孤独总比滥情好 2020-12-23 09:15

Is it somehow possible to have certain output appear in a different color in the IPython Notebook? For example, something along the lines of:

 print(\"Hello          


        
12条回答
  •  别那么骄傲
    2020-12-23 09:56

    Not with raw Python print. You will have to define a _repr_html_ on an object and return it or call IPython.lib.display(object_with_repr_html).

    I guess you could overwrite the built-in print to do it automatically...

    You could inspire from http://nbviewer.ipython.org/5098827, code in a gist on github, ML discussion here.

提交回复
热议问题