Answers for "how to read then overwrite a file with python with truncate"

0

how to read then overwrite a file with python with truncate

pythonCopywith open('myFolder/myfile.txt','r+') as myfile:
    data = myfile.read()
    myfile.seek(0)
    myfile.write('newData')
    myfile.truncate()
Posted by: Guest on June-21-2021

Code answers related to "how to read then overwrite a file with python with truncate"

Python Answers by Framework

Browse Popular Code Answers by Language