zoukankan      html  css  js  c++  java
  • Python: print stdout同行输出

    项目中发现,PyCharm运行youtube_dl下载,其进度在同行显示,即替换上行输出。

    稍做研究,记录下来:

    #coding=utf-8
    
    from __future__ import print_function
    import sys
    import time for i in xrange(100): # sys.stdout.write(' downloading... {0}%'.format(i + 1)) print(' downloading... {0}%'.format(i + 1), end='') time.sleep(0.1)

    即使用sys.stdout或sys.stderr输出,加 参数,或使用python3之print函数,end置空。其运行效果如下:

  • 相关阅读:
    ubuntu 1804 docker install
    windows shortcut
    gallary
    g++ play
    linux profile
    terminator
    tmux
    ubuntu18
    windows toolkit
    windows terminal CLI
  • 原文地址:https://www.cnblogs.com/crwy/p/9686324.html
Copyright © 2011-2022 走看看