Which of the following is NOT one of the four modes for opening a file in Python, using the open() function?

"r" (read)

"a" (append)

"d" (delete)

"w" (write)

1 answer

The mode that is NOT one of the four modes for opening a file in Python using the open() function is "d" (delete).

The valid modes are:

  • "r" for reading
  • "a" for appending
  • "w" for writing

There is no mode "d" for deleting files in the open() function. To delete a file, you would use the os.remove() function from the os module.