Thanks.
On Thu, Jun 6, 2013 at 4:49 PM, Cameron Simpson <c...@zip.com.au> wrote: > On 06Jun2013 03:50, Avnesh Shakya <avnesh.n...@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 <c...@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 >
-- http://mail.python.org/mailman/listinfo/python-list