Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #read #overwrite #file #python
ADD COMMENT
Topic
Name
1+3 =