如何在控制台的同一位置写入输出? [英] How do I write output in same place on the console?
本文介绍了如何在控制台的同一位置写入输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是python的新手,正在编写一些脚本来自动从FTP服务器等下载文件.我想显示下载进度,但希望它保持不变,例如:
I am new to python and am writing some scripts to automate downloading files from FTP servers, etc. I want to show the progress of the download, but I want it to stay in the same position, such as:
输出:
正在下载文件FooFile.txt [47%]
Downloading File FooFile.txt [47%]
我正试图避免这样的事情:
I'm trying to avoid something like this:
Downloading File FooFile.txt [47%]
Downloading File FooFile.txt [48%]
Downloading File FooFile.txt [49%]
我应该怎么做?
查看全文