MCQ Answer

which of the following will read entire content of file (file object 'f')?

which of the following will read entire content of file (file object 'f')?

निम्नलिखित में से कौन फ़ाइल (file object 'f') की संपूर्ण सामग्री को पढ़ेगा ?
Topic : File Processing in Python

A. f.reads()

B. f.read()

C. f.read(all)

D. f.read( *)




Correct Answer is :

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

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz