Python read / write file error valueerror: I/O operation on closed file

  Because with open will turn off file reading and writing by default, you need to open the file content in a read mode before file. Read()

 

Read More: