Qus निम्नलिखित में से कौन फ़ाइल (file object 'f') की संपूर्ण सामग्री को पढ़ेगा ?
A. f.reads()
B. f.read()
C. f.read(all)
D. f.read( *)
Solution
B. f.read()Explanation
To read the entire content of a file in Python, you can use the read() method on the file object.
Example:
f = open("filename.txt", "r") # Open the file in read mode
content = f.read() # Read the entire content of the file
f.close() # Close the file
print(content) # Print the content of the file