f = open(r"location.txt", "r+") //read value f.seek(-1, os.SEEK_END) //last value value in the file value = int(f.read())+1 // increment the value r