{ Snipperize } /console

Snippets about console

Here are the latest snippets talking about console. Please choose your favorite one or add a new one.

制作Shell下面的进度条

和apt / yum的进度条一样~ 原理都是用 “\b” 退格来完成

Python / console, progress bar, 进度条, shell / by ThePeppersStudio (229 days, 16.53 hours ago)

Network TCP backend for console access

Python / console, debug, interpreter, network, server side, SocketServer, TCPServer / by ThePeppersStudio (240 days, 10.69 hours ago)

Console (text) progress indicator class

Programs that run (FTP downloads, database insertions, etc.) sometimes require visual feedback to the user as to the progress of the task that is running. This progress bar class provides an easy to implement way of showing the percentage of completion that is updated periodically by the program. I was finding that I needed a progress indicator for Linux and Windows console applications that could be used to show the user that work was progressing and how much of the total work that had been completed. I finally broke down and wrote this class that seems to do exactly what I wanted. Since I continue to see questions about how to write such a class on Comp.Lang.Python, I thought I'd donate it to this Cookbook archive.

Python / console, progress bar / by ThePeppersStudio (252 days, 13.05 hours ago)

Creating a Progress Bar in Console

The follwing class can be used to add a progress bar to your console/text based applications. Add the following to a file called 'progress_bar.py' and import it into your application: And this would look like: [ ##################################### ] 67% Note: I find that adding sys.stdout.flush() keeps the output a bit cleaner sometimes. Also not that this is just an example, you wouldn't want to print the bar every single iteration unless its changed.

Python / console, progress bar / by ThePeppersStudio (252 days, 13.10 hours ago)

function to download a given URL with a console progress meter

Download a given URL with a console progress meter. The key function is sys.stdout.isatty() and sys.stdout.write("%-66s%3d%%" % (base, percent))

Python / console, download / by ThePeppersStudio (261 days, 17.62 hours ago)

  • 1