Answers for "overwrite file in 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

Python Answers by Framework

Browse Popular Code Answers by Language