t="/tmp/a" try:f=open(t);m=int(f.read()) except:m=1 print m f=open(t,"w") f.write("%d"%(m+1))