Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79177
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <vincent.vande.vyvre@telenet.be> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.018 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; 'string': 0.09; '%s"': 0.09; 'python': 0.11; 'def': 0.12; 'from:name:vincent vande vyvre': 0.16; 'increment': 0.16; 'received:195.130': 0.16; 'received:195.130.137': 0.16; 'received:telenet-ops.be': 0.16; '\xe9crit': 0.16; 'thanks,': 0.17; 'trying': 0.19; '>>>': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'script': 0.25; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'statement': 0.30; 'prints': 0.31; 'found.': 0.36; 'hi,': 0.36; 'should': 0.36; 'implement': 0.38; 'writes': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'new': 0.61; 'charset:windows-1252': 0.65; 'within': 0.65; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71 |
| Date | Wed, 15 Oct 2014 21:24:27 +0200 |
| From | Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Creating a counter |
| References | <loom.20141015T203348-999@post.gmane.org> |
| In-Reply-To | <loom.20141015T203348-999@post.gmane.org> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | vincent.vandevyvre@oqapy.eu |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14895.1413401793.18130.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1413401793 news.xs4all.nl 2967 [2001:888:2000:d::a6]:44983 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:79177 |
Show key headers only | View raw
Le 15/10/2014 20:39, Shiva a écrit : > Hi, > > I am trying to search a string through files in a directory - however while > Python script works on it and writes a log - I want to present the user with > count of number of strings found. So it should increment for each string found. > > How do I implement it? > > If I use a print() within a if condition statement - and execute the script > in terminal - for each find, the print() prints in new line instead of a > constantly incrementing counter. > > Thanks, > Shiva > Try this: >>> def counter(x): ... for i in range(x): ... print "\rProgress .............. %s" % i, ... sys.stdout.flush() ... time.sleep(1) ... >>> counter(5) Vincent.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Creating a counter Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2014-10-15 21:24 +0200
csiph-web