Created
November 25, 2019 03:31
-
-
Save MITsVision/d986a9c6d5bb2f25d20c72bc0c543c06 to your computer and use it in GitHub Desktop.
easy way to print different colors in jupyter notebook cells
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.display import HTML as html_print | |
def cstr(s, color='black'): | |
return "<text style=color:{}>{}</text>".format(color, s) | |
left, word, right = 'left print' , 'center print' , 'right print' | |
html_print(cstr(' '.join([left, cstr(word, color='green'), right]), color='black') ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment