On 06/06/2013 16:37, Chris Angelico wrote:
On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel <da...@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.
--
http://mail.python.org/mailman/listinfo/python-list