Computer Science
Which of the following mode will refer to binary data ?
- r
- w
- +
- b
Python File Handling
3 Likes
Answer
b
Reason — When we open a file in binary mode by adding 'b' to the file mode, it indicates that the file should be treated as a binary file.
Answered By
2 Likes
Related Questions
To read the remaining lines of the file from a file object infi, we use
- infi.read(all)
- infi.read()
- infi.readline()
- infi.readlines()
The readlines() method returns
- str
- a list of lines
- a list of single characters
- a list of integers
Which of the following statement is not correct ?
- We can write content into a text file opened using 'w' mode.
- We can write content into a text file opened using 'w+' mode.
- We can write content into a text file opened using 'r' mode.
- We can write content into a text file opened using 'r+' mode.
Which of the following option is the correct Python statement to read and display the first 10 characters of a text file "Notes.txt" ?
- F = open('Notes.txt') ; print(F.load(10))
- F = open('Notes.txt') ; print(F.dump(10))
- F = open('Notes.txt') ; print(F.read(10))
- F= open('Notes.txt') ; print(F.write(10))