Answers for "how to overwrite a file python"

2

how to read then overwrite a file with python

pythonCopywith open('myFolder/myfile.txt', "r") as myfile:
    data = myfilef.read()

with open('myFolder/myfile.txt', "w") as myfile:
    myfile.write(newData)
Posted by: Guest on June-21-2021

Code answers related to "how to overwrite a file python"

Python Answers by Framework

Browse Popular Code Answers by Language