How to print colored text in Python?

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

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

30条回答
  •  迷失自我
    2020-11-21 05:30

    If you are programming a game perhaps you would like to change the background color and use only spaces? For example:

    print " "+ "\033[01;41m" + " " +"\033[01;46m"  + "  " + "\033[01;42m"
    

提交回复
热议问题