कौन सा कथन फ़ाइल से एक पंक्ति लौटाएगा (फ़ाइल ऑब्जेक्ट 'f‟ है)?
Which statement will return one line from a file (file object is 'f‟) ?
A)
B)
C)
D)
Explanation:
- When you call
f.readline()
, it reads the next line from the file objectf
. It reads until it reaches the end of the line, including the newline character (\n
), but it does not return the newline character at the end of the string. - If the end of the file is reached,
f.readline()
returns an empty string (''
).