More information probably is needed, but if you want to sequentially name files to avoid name clashes etc you don't necessarily need a separate file to record the current number. I'm assuming you want to write a new file from time to time, numbering to keep track of things?
So given a set of files, you want to know what the next valid file name would be.
Something like (for files in the current directory):
import os.path
def next_file_name():
num = 1
while True:
file_name = 'file%d.txt' % num
if not os.path.exists(file_name):
return file_name
num += 1
Obviously though as the number of files in the directory increases this will get slower, so it depends on how many files you expect there to be.