python技巧

打包文件
pyinstaller -F xxx.py
  #–icon=图标路径
  #-F 打包成一个exe文件
  #-w 使用窗口,无控制台
  #-c 使用控制台,无窗口
  #-D 创建一个目录,里面包含exe以及其他一些依赖性文件
  #pyinstaller -h 来查看参数
  #有命令窗口弹出
      pyinstaller -F a.py  
  #无命令窗口弹出
      pyinstaller -F -w a.py  
  #或者
      pyinstaller -F a.py  --noconsole
终端背景颜色
Windows CMD控制台颜色
    import os
    os.system('color 1f') # sets the background to blue

Linux终端
    import os
    os.system('setterm -background white -foreground white -store')
print函数显示颜色
https://blog.csdn.net/qq_37952052/article/details/124110713
https://blog.csdn.net/qq_38962621/article/details/108038966  
print("\033[显示方式;前景颜色;背景颜色m…\033[0m")
print("\033[0;32;44m" + "     " + i + "\033[0m")
posted @ 2022-06-29 16:12  tangshow  阅读(20)  评论(0编辑  收藏  举报