【发布时间】:2020-10-13 15:02:00
【问题描述】:
我想当一个Ascii艺术把我用Python创建的东西转换成图像输出,我不知道具体怎么做,Text to Ascii art我想变成一张照片,谢谢你的帮助和指导.. .
from pyfiglet import figlet_format
from termcolor import colored
def Print_art(msg, color):
Valid_colors = ("red", "green", "yellow", "blue", "magenta", "cyan", "white")
if color not in Valid_colors:
color = "magenta"
ascii_art = figlet_format(msg)
colored_ascii = colored(ascii_art, color=color)
print(colored_ascii)
msg = input("what would you like to print? ")
color = input("what color? ")
Print_art(msg, color)
【问题讨论】: