Mode: Description:
"r" # Opens a file for reading. (default)
"w" # Opens a file for writing. Creates a new file if it does not exist or truncates the file if it exists.
"x" # Opens a file for exclusive creation. If the file already exists, the operation fails.
"a" # Opens a file for appending at the end of the file without truncating it. Creates a new file if it does not exist.
"t" # Opens in text mode. (default)
"b" # Opens in binary mode.
"+" # Opens a file for updating (reading and writing)
# Different modes of text file
"r" = # Open for reading plain text
"w" = # Open for writing plain text
"a" = # Open an existing file for appending plain text
"rb" = # Open for reading binary data
"wb" = # Open for writing binary data