"r" Open for reading
"w" Open for writing (truncating to zero length)
"a" Open for append
"r+" Open for read/write (updates)
"w+" Open for read/write (with truncation to zero length)
Notes
A 'b' may be appended to the mode to indicate binary data.
This is required for portability to Windows.
"+" modes allow random-access updates to the file.