from ctypes import windll STD_OUTPUT_HANDLE = -11 # input -10, error -12
stdout_handle = windll.kernel32.GetStdHandle(STD_OUTPUT_HANDLE)
def f(x,easy=True):
x = x*16 if easy else x
windll.kernel32.SetConsoleTextAttribute(stdout_handle, x)
def print_(l,px=' '):
# l为一行的颜色列表, 取值0~15(现成的颜色就这么几种,自己看吧), 长度小于命令行宽度
length = len(l)
lines = [px*i for i in range(len(l))]
for x in reversed(l):
f(x)
print(lines.pop(),end='\r')
print()
import random
for x in range(34):
l = [random.randint(0,15) for i in range(40)]
print_(l)
f(0x07,False)