Open mode parameter

Mode Mode Description Description
r Open a text file in read mode, allowing the file to be read
w Open a text file in write mode, allowing writing to the file
a Open a text file in append modeIf the file does not exist, a new one will be created
r+ Open a text file in read-write mode, allowing reading and writing of the file
w+ Open a text file in read-write mode, allowing reading and writing of the file
a+ Open a text file in read-write mode, allowing reading and writing of the file
rb Open a binary file in read mode
wb Open binary file in write mode
ab Open a binary file in append mode
rb+ open binary file in read-write mode
wb+ Open binary file in read-write mode
ab+ open binary file in read-write mode
Comments