W = '\033[0m' # white (normal)
R = '\033[31m' # red
G = '\033[32m' # green
O = '\033[33m' # orange
B = '\033[34m' # blue
P = '\033[35m' # purple
print(R+"hello how are you"+W)
from colorconsole import terminal
screen = terminal.get_terminal(conEmu=False)
screen.cprint(4, 0, "This is red\n")
screen.cprint(10, 0, "This is light green\n")
screen.cprint(0, 11, "This is black on light cyan\n")
screen.reset_colors()
定义如下颜色:
演示:
请在此处查看所有颜色代码:Color Codes
使用诸如
colorconsole
这样的模块更容易:然后,例如
如果可用,它还支持256/24位颜色。
使用彩色模块。
https://pypi.org/project/colored/
相关问题 更多 >
编程相关推荐