PROGRAM next line ROGRA next line OGR next line G
Answers
Answered by
0
When we read files in Python, we want to detect empty lines and the file's end. When we call readline() we get the next line, if one exists.
With this method, we receive an unambiguous result. An empty string always means the end of the file has been reached. A newline string means a blank line was encountered.
An example program. Here we use a while-True loop. We must terminate the loop based on the result of the read line() method. We have 2 if-statements.
With this method, we receive an unambiguous result. An empty string always means the end of the file has been reached. A newline string means a blank line was encountered.
An example program. Here we use a while-True loop. We must terminate the loop based on the result of the read line() method. We have 2 if-statements.
Similar questions
Biology,
8 months ago
English,
1 year ago
Social Sciences,
1 year ago
History,
1 year ago
Art,
1 year ago