让python输出有颜色
from colorama import Fore, Style
def print_with_color(text: str, color=""):
if color == "red":
print(Fore.RED + text)
elif color == "green":
print(Fore.GREEN + text)
elif color == "yellow":
print(Fore.YELLOW + text)
elif color == "blue":
print(Fore.BLUE + text)
elif color == "magenta":
print(Fore.MAGENTA + text)
elif color == "cyan":
print(Fore.CYAN + text)
elif color == "white":
print(Fore.WHITE + text)
elif color == "black":
print(Fore.BLACK + text)
else:
print(text)
print(Style.RESET_ALL)

浙公网安备 33010602011771号