让你的python输出彩色字体 支持 py3
2012-02-22 10:28
686 查看
这个模块是:
代码如下
Text colors:
grey
red
green
yellow
blue
magenta
cyan
white
Text highlights:
on_grey
on_red
on_green
on_yellow
on_blue
on_magenta
on_cyan
on_white
Attributes:
bold
dark
underline
blink
reverse
concealed
下载地址:http://pypi.python.org/pypi/termcolor/1.1.0#downloads
termcolor 1.1.0
代码如下import sys from termcolor import colored, cprint text = colored('Hello, World!', 'red', attrs=['reverse', 'blink']) print(text) cprint('Hello, World!', 'green', 'on_red') print_red_on_cyan = lambda x: cprint(x, 'red', 'on_cyan') print_red_on_cyan('Hello, World!') print_red_on_cyan('Hello, Universe!') for i in range(10): cprint(i, 'magenta', end=' ') cprint("Attention!", 'red', attrs=['bold'], file=sys.stderr)
Text Properties
Text colors:grey
red
green
yellow
blue
magenta
cyan
white
Text highlights:
on_grey
on_red
on_green
on_yellow
on_blue
on_magenta
on_cyan
on_white
Attributes:
bold
dark
underline
blink
reverse
concealed
Terminal properties
Terminal | bold | dark | underline | blink | reverse | concealed |
xterm | yes | no | yes | bold | yes | yes |
linux | yes | yes | bold | yes | yes | no |
rxvt | yes | no | yes | bold/black | yes | no |
dtterm | yes | yes | yes | reverse | yes | yes |
teraterm | reverse | no | yes | rev/red | yes | no |
aixterm | normal | no | yes | no | yes | yes |
PuTTY | color | no | yes | no | yes | no |
Windows | no | no | no | no | yes | no |
Cygwin SSH | yes | no | color | color | color | yes |
Mac Terminal | yes | no | yes | yes | yes | yes |
相关文章推荐
- Python终端输出打印彩色字体的方法
- python终端如何输出彩色字体
- Python/Perl/Shell 输出彩色字体
- Python/Perl/Shell 输出彩色字体
- Python24 终端如何输出彩色字体
- Python在终端输出彩色字体
- Python终端如何输出彩色字体
- Python终端如何输出彩色字体
- python之终端输出彩色字体
- Python终端如何输出彩色字体
- Python终端如何输出彩色字体
- python输出彩色字体
- python彩色文字输出
- Python3_Print输出带颜色字体
- Python在windows命令行下输出彩色文字
- python 输出彩色文字
- python26 中文格式输出 支持
- python输出带颜色的字体
- C#控制台应用程序中输出彩色字体
- python 输出彩色文字