def update(self, newData): beforeWritePos = self.tell() self.seek(0, io.SEEK_END) self.write(newData) self.seek(beforeWritePos)