代码之家  ›  专栏  ›  技术社区  ›  Kamil Kisiel

Python是否有一个术语::ANSIScreen等价物?

  •  3
  • Kamil Kisiel  · 技术社区  · 16 年前

    Term::ANSIScreen

    4 回复  |  直到 16 年前
        1
  •  8
  •   Jorge Vargas    15 年前

    如果您只需要颜色,您可能需要借用pygments的实现。依我看,它比ActiveState的干净多了

    http://dev.pocoo.org/hg/pygments-main/file/b2deea5b5030/pygments/console.py

        2
  •  3
  •   Community CDub    7 年前

    还有 termcolor termstyle 包装。如果标准输出不是终端,则后者能够禁用颜色输出。

    另见 this question

        3
  •  3
  •   Jeff Bauer    13 年前

    这里有一个 cookbook recipe

    [编辑:Jorge Vargas提交的上述pygments代码是一种更好的方法。]

        4
  •  2
  •   monkut    16 年前

    虽然我自己没有使用过,但我相信诅咒库通常用于:

    http://docs.python.org/library/curses.html

    http://docs.python.org/howto/curses.html#curses-howto

    不幸的是,该模块在windows标准库中似乎不可用。

    http://adamv.com/dev/python/curses/