How to print colored text in Python?

前端 未结 30 2976
谎友^
谎友^ 2020-11-21 04:41

How can I output colored text to the terminal in Python?

30条回答
  •  春和景丽
    2020-11-21 05:30

    For Windows you cannot print to console with colors unless you're using the win32api.

    For Linux it's as simple as using print, with the escape sequences outlined here:

    Colors

    For the character to print like a box, it really depends on what font you are using for the console window. The pound symbol works well, but it depends on the font:

    #
    

提交回复
热议问题