jjzjj

python - 控制台颜色 (Windows)

是否可以在PythonforWindows中打印出不同颜色的东西?我已经启用了ANSI.sys,但这并不能正常工作。我希望能够以红色打印一行,然后以绿色打印下一行,等等。 最佳答案 WConio模块应该是完成此操作所需的全部内容。WConio.textbackground(color)setsthebackgroundcolorwithoutchangingtheforeground.Seebelowforthecolorconstants.WConio.textcolor(color)setstheforegroundcolorw