I am required to edit the file that's just created using copyFile()
.
However, readlines()
always fails if the file is opened in either 'w'
mode or 'w+'
or in 'a'
mode.
copyfile(fileObj.file_to_open, fileObj._copyToFileName)
with open(fileObj._copyToFileName, 'w') as thisFile:
lines = thisFile.readlines()
I am able to readlines()
if I leave it to default mode (read mode).
Why would the open with write mode be a problem?