'rb', ab, a + b, r+
Reason —
- 'rb' — This mode opens the file for reading in binary mode. It will not erase the existing data and allows reading of the file.
- 'ab' — This mode opens the file for appending in binary mode. It will not erase the existing data but will append new data to the end of the file.
- 'a + b' — This mode opens the file for reading and appending. It will not erase the existing data and allows both reading from and appending to the file.
- 'r+' — This mode opens the file for reading and writing. It will not erase the existing data and allows both reading from and writing to the file.