-2

I'm confused and don't know what to do about this. I'm trying to overwrite the files text.

1 Answers1

0

when opening a file with 'w' flag, it will rewrite the file if it exists.

with open('yourfile.ext', 'wt') as fileObj:
    fileObj.write(stuff)
kmaork
  • 5,722
  • 2
  • 23
  • 40