Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #47233
| References | <854fde32-9a5a-483e-b135-5d2c0d21b49b@googlegroups.com> <51B07D29.404@davea.name> |
|---|---|
| Date | 2013-06-07 01:37 +1000 |
| Subject | Re: How to store a variable when a script is executing for next time execution? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2808.1370533038.3114.python-list@python.org> (permalink) |
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.
ChrisA
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