python - How to easily print ascii-art text? -


i have program dumps lot of output, , i want of output stand out. 1 way render important text ascii art, this web service example:

 #    #   ##   #####  #    # # #    #  ####    #    #  #  #  #    # ##   # # ##   # #    #   #    # #    # #    # # #  # # # #  # #        # ## # ###### #####  #  # # # #  # # #  ###   ##  ## #    # #   #  #   ## # #   ## #    #   #    # #    # #    # #    # # #    #  ####   

other solutions colored or bold output. how sort of stuff in python?

  • pyfiglet - pure python implementation of http://www.figlet.org

    pip install pyfiglet 
  • termcolor - helper functions ansi color formatting

    pip install termcolor 
  • colorama - multiplatform support (windows)

    pip install colorama 
import sys  colorama import init init(strip=not sys.stdout.isatty()) # strip colors if stdout redirected termcolor import cprint  pyfiglet import figlet_format  cprint(figlet_format('missile!', font='starwars'),        'yellow', 'on_red', attrs=['bold']) 

example

$ python print-warning.py  

missile

 $ python print-warning.py | cat .___  ___.  __       _______.     _______. __   __       _______  __ |   \/   | |  |     /       |    /       ||  | |  |     |   ____||  | |  \  /  | |  |    |   (----`   |   (----`|  | |  |     |  |__   |  | |  |\/|  | |  |     \   \        \   \    |  | |  |     |   __|  |  | |  |  |  | |  | .----)   |   .----)   |   |  | |  `----.|  |____ |__| |__|  |__| |__| |_______/    |_______/    |__| |_______||_______|(__) 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -