Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #47221
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <avnesh.nitk@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.026 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'slow.': 0.09; 'subject:script': 0.09; 'try:': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; 'python': 0.11; 'ioerror:': 0.16; 'possible?': 0.16; 'simpson': 0.16; 'subject:variable': 0.16; 'subject:when': 0.16; 'survive': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'trying': 0.19; 'skip:f 30': 0.19; 'thu,': 0.19; 'thanks.': 0.20; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'script': 0.25; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'names.': 0.31; 'subject:next': 0.31; 'file': 0.32; 'run': 0.32; 'open': 0.33; 'url:python': 0.33; 'running': 0.33; 'subject:time': 0.33; 'could': 0.34; 'created': 0.35; 'except': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'var': 0.36; 'url:listinfo': 0.36; 'next': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'should': 0.36; 'skip:& 10': 0.38; 'audio': 0.38; 'files': 0.38; 'pm,': 0.38; 'enough': 0.39; 'according': 0.40; 'url:mail': 0.40; 'how': 0.40; 'read': 0.60; 'free': 0.61; 'break': 0.61; 'skip:o 30': 0.61; 'new': 0.61; 'save': 0.62; 'name': 0.63; 'pick': 0.64; 'more': 0.64; 'url:jsp': 0.68; 'played': 0.84; 'players.': 0.84; '2013': 0.98 |
| 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 :cc:content-type; bh=3EAMGiJcvb0oAgEDtjeoD3Owep44UM9jISMTYq3qjV4=; b=bAQVIsdX3urYBaXWixvMgUe8m3ODXoGbHDUlibQy6EtI//28shb2Ev+MfAKRRzbCHL o1Rz/hpOsql022KllXxtWoN7QLWqgykYFvLbWhDr1bVGDU6qAA/YHoSXQUafNk2wvFrj DoVeMwRbhppuBHTn58YE6XVsPrkrreWpDkFskLiqTnIOAcbFhs2fn15KuBn0wbo2WpZZ us/0MH78TPP0D6y1zS8lbjPpHBCu1e9RuiHVpb3TKMcZ61mug8j4mfN9nDDlEPEN2uwB kS3fjH7kZ1GpuA3XFRyYqeXL9UQ/MGFG1hJ9YFAJMP8l5rnBGQr+XfWniBgI1G6fLx0V 9bJw== |
| MIME-Version | 1.0 |
| X-Received | by 10.42.250.202 with SMTP id mp10mr16760808icb.21.1370520382220; Thu, 06 Jun 2013 05:06:22 -0700 (PDT) |
| In-Reply-To | <20130606111904.GA29595@cskk.homeip.net> |
| References | <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> <20130606111904.GA29595@cskk.homeip.net> |
| Date | Thu, 6 Jun 2013 17:36:22 +0530 |
| Subject | Re: How to store a variable when a script is executing for next time execution? |
| From | Avnesh Shakya <avnesh.nitk@gmail.com> |
| To | Cameron Simpson <cs@zip.com.au> |
| Content-Type | multipart/alternative; boundary=20cf3010e6c98a328204de7b24ee |
| Cc | python-list@python.org |
| 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.2801.1370520389.3114.python-list@python.org> (permalink) |
| Lines | 116 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1370520389 news.xs4all.nl 15968 [2001:888:2000:d::a6]:45259 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:47221 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Thanks.
On Thu, Jun 6, 2013 at 4:49 PM, Cameron Simpson <cs@zip.com.au> wrote:
> On 06Jun2013 03:50, Avnesh Shakya <avnesh.nitk@gmail.com> wrote:
> | hi,
> | I am running a python script and it will create a file name like
> filename0.0.0 and If I run it again then new file will create one more like
> filename0.0.1...... my code is-
> |
> | i = 0
> | for i in range(1000):
> | try:
> | with open('filename%d.%d.%d.json'%(0,0,i,)): pass
> | continue
> | except IOError:
> | dataFile = file('filename%d.%d.%d.json'%(0,0,i,), 'a+')
> | break
> | But It will take more time after creating many files, So i want to store
> value of last var "i" in a variable so that when i run my script again then
> I can use it. for example-
> | my last created file is filename0.0.27 then it should
> store 27 in a variable and when i run again then new file should be created
> 0.0.28 according to last value "27", so that i could save time and it can
> create file fast..
> |
> | Please give me suggestion for it.. How is it possible?
>
> Write it to a file? Read the file next time the script runs?
>
> BTW, trying to open zillions of files is slow.
> But using listdir to read the directory you can see all the names.
> Pick the next free one (and then test anyway).
> --
> Cameron Simpson <cs@zip.com.au>
>
> The mark must be robust enough to survive MP3 transmission over the
> Internet,
> but remain inaudible when played on the yet to be launched DVD-Audio
> players.
> - the SDMI audio watermarkers literally ask for the impossible, since all
> audio compressors aim to pass _only_ human perceptible data
> http://www.newscientist.com/news/news.jsp?id=ns224836
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to store a variable when a script is executing for next time execution? Avnesh Shakya <avnesh.nitk@gmail.com> - 2013-06-06 03:50 -0700 Re: How to store a variable when a script is executing for next time execution? Cameron Simpson <cs@zip.com.au> - 2013-06-06 21:19 +1000 Re: How to store a variable when a script is executing for next time execution? Avnesh Shakya <avnesh.nitk@gmail.com> - 2013-06-06 17:36 +0530 Re: How to store a variable when a script is executing for next time execution? Dave Angel <davea@davea.name> - 2013-06-06 08:14 -0400 Re: How to store a variable when a script is executing for next time execution? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-06-06 15:46 +0300 Re: How to store a variable when a script is executing for next time execution? Chris Angelico <rosuav@gmail.com> - 2013-06-07 01:37 +1000 Re: How to store a variable when a script is executing for next time execution? MRAB <python@mrabarnett.plus.com> - 2013-06-06 16:54 +0100 Re: How to store a variable when a script is executing for next time execution? Chris Angelico <rosuav@gmail.com> - 2013-06-07 01:56 +1000
csiph-web