Python控制台输出各种颜色
python -m pip install colorama
init(wrap=True)
import colorama colorama.init(wrap=True, autoreset=True) print("normal") print(colorama.Style.BRIGHT + "Bright") print(colorama.Fore.RED + "Red") print(colorama.Back.BLUE + "Blue") print("%10s" % "", end="")for back in colorama.Back.__dict__: print("%10s" % (back if len(back) < 9 else back[:9]), end="") print()for fore in colorama.Fore.__dict__: print("%10s" % (fore if len(fore) < 9 else fore[:9]), end="") for back in colorama.Back.__dict__: print(colorama.Fore.__dict__[fore] + colorama.Back.__dict__[back] + "%10s" % "xxx", end="") print("") colorama.deinit() print(colorama.Fore.RED+"Red") print("Still Red") print(colorama.Fore.RESET+"Reset")