pythonCopywith open('myFolder/myfile.txt','r+') as myfile: data = myfile.read() myfile.seek(0) myfile.write('newData') myfile.truncate()