+3 votes
in Mathematics by kratos

What are the different modes in which a file can be opened.

1 Answer

+5 votes
by kratos
 
Best answer

Different modes for opening a file are tabulated below:

| Modes | Operations |
| “r” | Open text file for reading |
| “w” | Open text file for writing, previous content, if any, discarded |
| “a” | Open or create file for writing at the end of the file |
| “r+” | Open text file for update |
| “w+” | Create or open text file for update, previous content lost, if any |
| “a+” | Open or create text file for update, writing at the end. |

...