python 重新认识print
flush
通过 设置flush = True来实现进度条
file
file可以输入到文件,sys.stdout是默认输出到屏幕
打印颜色
格式:\033[显示方式;字体色;背景色m......[\033[0m
-------------------------------------------字体色 | 背景色 | 颜色描述-------------------------------------------30 | 40 | 黑色31 | 41 | 红色32 | 42 | 绿色33 | 43 | 黃色34 | 44 | 蓝色35 | 45 | 紫红色36 | 46 | 青蓝色37 | 47 | 白色--------------------------------------------------------------------------显示方式 | 效果-------------------------------0 | 终端默认设置1 | 高亮显示4 | 使用下划线5 | 闪烁7 | 反白显示8 | 不可见-------------------------------print('This is a \033[1;35m test \033[0m!') print('This is a \033[1;32;43m test \033[0m!') print('\033[1;33;44mThis is a test !\033[0m')


浙公网安备 33010602011771号