CBSE Class 12 Computer Science
Question 84 of 136
Data File Handling — Question 23
Back to all questions 23
Question Write the file mode that will be used for opening the following files. Also, write the Python statements to open the following files:
- a text file "example.txt" in both read and write mode.
- a binary file "bfile.dat" in write mode
- a text file "try.txt" in append and read mode
- a binary file "btry.dat" in read only mode
- File Mode: 'r+'
fh = open("example.txt", "r+")- File Mode: 'wb'
fh = open("bfile.dat", "wb")- File Mode: 'a+'
fh = open("try.txt", "a+")- File Mode: 'rb'
fh = open("btry.dat", "rb")