colorama是python第三方库中一个可以改变输出流颜色的玩意儿, 安装可以通过:
- pip install colorama
-
- from colorama import Fore, Back, Style
-
- for color in ['GREEN', 'RED', 'BLUE', 'YELLOW', 'WHITE']:
- print getattr(Fore, color), "It's color will be", color
- print getattr(Back, color), "It's color will be", color
- print Style.RESET_ALL
-
官方文档:colorama