狐狸.fox 2008-11-13 18:58 采纳率: 100%
浏览 762

终端打印用颜色?

How can I output colored text to the terminal, in Python? What is the best Unicode symbol to represent a solid block?

转载于:https://stackoverflow.com/questions/287871/print-in-terminal-with-colors

  • 写回答

27条回答 默认 最新

  • Didn"t forge 2008-11-13 19:06
    关注

    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:

    #
    
    评论

报告相同问题?