Computer Science, asked by timmy53, 1 year ago


what is the difference between readline() and readlines() function?

Answers

Answered by rumourgirl
20

HEY BUDDY ♥♥♥

HERE'S THE ANSWER ✌

⤵⤵⤵⤵⤵

The readline () function reads from a file in read mode and returns the next line in the file or a blank string if there are no more lines.(The returned data is of string type).

The readlines () function also reads from a file in read mode and returns a list of all lines in the file.(The returned data is of list type).

♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦♦

HOPE YOU FIND IT HELPFUL ☺☺☺

Answered by hinaguptagracy
6

Explanation:

readline() reads a single line from the file; a newline character (\n) is left at the end of the string, and is only omitted on the last line of the file if the file doesn't end in a newline. ... So the readlines uses the readline function to "read many times" the file.

Similar questions