杂:python_windows标准输出带颜色

import ctypes

handle = ctypes.windll.kernel32.GetStdHandle(-11) # -11 for output   -10 for input   -12 for error

ctypes.windll.kernel32.SetConsoleTextAttribute(handle, 0x01) # foreground=bule     0x10 background=blue

posted @ 2022-01-30 13:18  小葱饼子  阅读(57)  评论(0)    收藏  举报