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

2013-06-06 Thread Chris Angelico
On Fri, Jun 7, 2013 at 1:54 AM, MRAB wrote: > On 06/06/2013 16:37, Chris Angelico wrote: >> >> On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel 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

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

2013-06-06 Thread MRAB
On 06/06/2013 16:37, Chris Angelico wrote: On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel 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

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

2013-06-06 Thread Chris Angelico
On Thu, Jun 6, 2013 at 10:14 PM, Dave Angel 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 fi

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

2013-06-06 Thread Jussi Piitulainen
Avnesh Shakya writes: > 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,

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

2013-06-06 Thread Dave Angel
On 06/06/2013 06:50 AM, Avnesh Shakya 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 Redundant initialization of i. for i in range(1000):

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

2013-06-06 Thread Avnesh Shakya
Thanks. On Thu, Jun 6, 2013 at 4:49 PM, Cameron Simpson wrote: > On 06Jun2013 03:50, Avnesh Shakya 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

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

2013-06-06 Thread Cameron Simpson
On 06Jun2013 03:50, Avnesh Shakya 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('file

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

2013-06-06 Thread Avnesh Shakya
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