📅  最后修改于: 2022-03-11 14:45:52.451000             🧑  作者: Mango
pythonCopywith open('myFolder/myfile.txt','r+') as myfile:
data = myfile.read()
myfile.seek(0)
myfile.write('newData')
myfile.truncate()