安装colorama

代码

1
2
3
4
5
6
7
8
9
10
11
from colorama import init, Fore, Back, Style

init()

print(Fore.RED + 'some red text')
print(Fore.GREEN + 'some green text')
print(Fore.RESET)
print(Back.GREEN + 'and with a green background')
print(Style.DIM + 'and in dim text')
print(Fore.RESET + Back.RESET + Style.RESET_ALL)
print('back to normal now')

留言