📜  如何使用 python 代码示例读取然后覆盖文件

📅  最后修改于: 2022-03-11 14:46:53.046000             🧑  作者: Mango

代码示例1
pythonCopywith open('myFolder/myfile.txt', "r") as myfile:
    data = myfilef.read()

with open('myFolder/myfile.txt', "w") as myfile:
    myfile.write(newData)