Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30367
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'output': 0.04; '%s"': 0.07; 'msg': 0.07; 'scripts': 0.09; 'formatted': 0.09; 'sep': 0.09; 'whole,': 0.09; '10:05': 0.16; 'enough.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'say)': 0.16; 'string': 0.17; 'wrote:': 0.17; 'previously': 0.18; 'received:209.85.214.174': 0.21; 'random': 0.24; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'question': 0.27; 'message- id:@mail.gmail.com': 0.27; 'fixed': 0.28; 'subject:/': 0.28; 'spaces': 0.29; 'case,': 0.29; 'fri,': 0.30; 'function': 0.30; 'print': 0.32; 'done,': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'add': 0.36; 'but': 0.36; 'method': 0.36; 'should': 0.36; 'enough': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'effective': 0.63; 'increase': 0.72; 'wipe': 0.84; 'total,': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=OhQFvaKUSe1YFBKEZZyuzuWV2FLMXPela8op+BgLR5k=; b=xldQ0QITY1+aCMMRuQgPCV3P6hU/ts/jzuBkhzFvOPdC2PEouwcqSGq9wI4I0PRZzS UTUOzqksL6K7VpZUx62NtsIQYwlJMeRrMS2B3f+wiw6oDsGOnzgUTkJ/t+YqIcvP/Y7/ awVZDkvBEsJflKD81jFtg6CwZvXD1QZUSm4/xp+3yGGitb89m/H7nFPBajeZ5NyULuQZ ZlHp5SwmixGcNh5zuHOLgooZFU030R1nAfTGp2Smx08oKnx6C35DNazUXDip/YB75yPG ZVhLRleKx51ViCDRavWG9/8SpAZlAjmyMScXvZ4y6YLOkJNPk/ShJ5B46gziS2BiIjsQ ajaA== |
| MIME-Version | 1.0 |
| In-Reply-To | <686fj9-aql.ln1@murmur.very.softly> |
| References | <cmuej9-0ml.ln1@murmur.very.softly> <mailman.1522.1348783807.27098.python-list@python.org> <k42jp3$1nc$1@reader1.panix.com> <mailman.1523.1348785513.27098.python-list@python.org> <686fj9-aql.ln1@murmur.very.softly> |
| Date | Fri, 28 Sep 2012 18:08:58 +1000 |
| Subject | Re: Reducing cache/buffer for faster display |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1544.1348819742.27098.python-list@python.org> (permalink) |
| Lines | 18 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348819742 news.xs4all.nl 6903 [2001:888:2000:d::a6]:50846 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:30367 |
Show key headers only | View raw
On Fri, Sep 28, 2012 at 10:05 AM, Rikishi42 <skunkworks@rikishi42.net> wrote: > The scripts in question only increase numbers. But should that not be the > case, solutions are simple enough. The numbers can be formatted to have a > fixed size. In the case of random line contents (a list of filesnames, say) > it's enough to create an output function that is aware of the length of the > previously printed line, and add enough spaces to the current one to wipe > exess content. Yep, that's a pretty effective way to do it. One simple method to it is to format the whole string as a single whole, then left justify it in a field of (say) 79 characters, and output that: msg = "Progress: %d%% (%d/%d)... %s" % (done*100/total, done, total, current_file) print msg.ljust(79)+"\r", sys.stdout.flush() ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Reducing cache/buffer for faster display Rikishi42 <skunkworks@rikishi42.net> - 2012-09-27 23:57 +0200
Re: Reducing cache/buffer for faster display Chris Angelico <rosuav@gmail.com> - 2012-09-28 08:09 +1000
Re: Reducing cache/buffer for faster display John Gordon <gordon@panix.com> - 2012-09-27 22:25 +0000
Re: Reducing cache/buffer for faster display Chris Angelico <rosuav@gmail.com> - 2012-09-28 08:38 +1000
Re: Reducing cache/buffer for faster display Rikishi42 <skunkworks@rikishi42.net> - 2012-09-28 02:05 +0200
Re: Reducing cache/buffer for faster display Chris Angelico <rosuav@gmail.com> - 2012-09-28 18:08 +1000
Re: Reducing cache/buffer for faster display Rikishi42 <skunkworks@rikishi42.net> - 2012-09-29 02:31 +0200
Re: Reducing cache/buffer for faster display Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-27 21:46 -0400
Re: Reducing cache/buffer for faster display Rikishi42 <skunkworks@rikishi42.net> - 2012-09-29 02:20 +0200
Re: Reducing cache/buffer for faster display Hans Mulder <hansmu@xs4all.nl> - 2012-09-29 14:32 +0200
Re: Reducing cache/buffer for faster display Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-29 14:12 -0400
Re: Reducing cache/buffer for faster display Rikishi42 <skunkworks@rikishi42.net> - 2012-09-28 02:15 +0200
csiph-web