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

后端 未结 12 1181
孤独总比滥情好
孤独总比滥情好 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 10:04

    In the Jupiter notebook, we can use a color marker to print the output in different colors There are three ways that we can use a color marker.

    let's see how to print a yellow color in a notebook.

    1. print('\033[93m output')
    2. print('\033[93m' 'output')
    3. print('\033[93m' + 'output')

    Some of the colors are :

    • yellow = '\033[93m'
    • green = '\033[92m'
    • red = '\033[91m'
    • blue = '\033[94m'
    • pink = '\033[95m'

    you can change the last number and get other colors as well.

提交回复
热议问题