Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #47237

Re: How to store a variable when a script is executing for next time execution?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.022
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'algorithm': 0.04; 'binary': 0.07; 'assuming': 0.09; 'subject:script': 0.09; 'subject:How': 0.10; "'w')": 0.16; '(meaning': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'subject: \n ': 0.16; 'subject:variable': 0.16; 'subject:when': 0.16; 'files.': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'header:User- Agent:1': 0.23; 'file.': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'existence': 0.31; 'subject:next': 0.31; 'subject:time': 0.33; 'could': 0.34; 'next': 0.36; 'subject:?': 0.36; 'checks': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'planning': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'dave': 0.60; "you're": 0.61; 'header:Reply-To:1': 0.67; 'equals': 0.68; 'limit': 0.70; 'reply-to:no real name:2**0': 0.71; 'reply-to:addr:python.org': 0.84; 'angel': 0.91; 'gaps': 0.93; '2013': 0.98
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=KrN0hwmN c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=oyR3mlnJdzkA:10 a=Akf1ylsSNtwA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=BMYZR9uYiSUA:10 a=ekxJSCFMZvBWJMiBkfkA:9 a=HxMiCoyDvHHk_rbR:21 a=dcSmYEvDEyhstYAK:21 a=wPNLvfGTeEIA:10
X-AUTH mrabarnett:2500
Date Thu, 06 Jun 2013 16:54:13 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6
MIME-Version 1.0
To python-list@python.org
Subject Re: How to store a variable when a script is executing for next time execution?
References <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> <51B07D29.404@davea.name> <CAPTjJmqRpif0qo0Emkp7fZqOnaMtY5-JHj=tVnvNJAo1NPsobg@mail.gmail.com>
In-Reply-To <CAPTjJmqRpif0qo0Emkp7fZqOnaMtY5-JHj=tVnvNJAo1NPsobg@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To python-list@python.org
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.2811.1370534054.3114.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1370534054 news.xs4all.nl 15935 [2001:888:2000:d::a6]:35509
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:47237

Show key headers only | View raw


On 06/06/2013 16:37, Chris Angelico wrote:
> On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel <davea@davea.name> wrote:
>> If you're planning on having the files densely populated (meaning no gaps in
>> the numbering), then you could use a binary search to find the last one.
>> Standard algorithm would converge with 10 existence checks if you have a
>> limit of 1000 files.
>
> Or, if you can dedicate a directory to those files, you could go even simpler:
>
> dataFile = open('filename0.0.%d.json'%len(os.listdir()), 'w')
>
> The number of files currently existing equals the number of the next file.
>
Assuming no gaps.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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