【Python 练习实例35】文本颜色设置。
【分析】参考《Python输出彩色文本》 中对颜色的设置。
1 2 3 4 5 6 7 8 |
print('\033[1;30;41m', 'hello world!', '\033[0m') print('\033[1;31;42m', 'hello world!', '\033[0m') print('\033[1;32;43m', 'hello world!', '\033[0m') print('\033[1;33;44m', 'hello world!', '\033[0m') print('\033[1;34;45m', 'hello world!', '\033[0m') print('\033[1;35;46m', 'hello world!', '\033[0m') print('\033[1;36;47m', 'hello world!', '\033[0m') print('\033[1;37;40m', 'hello world!', '\033[0m') |
输出: