flush

通过 设置flush = True来实现进度条

python 重新认识print

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')

python 重新认识print

 

相关文章:

  • 2021-10-01
  • 2021-12-30
  • 2021-08-25
  • 2021-06-23
  • 2021-08-10
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-03
  • 2021-05-27
  • 2021-09-19
  • 2022-01-10
  • 2021-11-20
  • 2021-12-12
相关资源
相似解决方案