Python file.readline() Method
The readline() method returns one line from the file.
You can also specified how many bytes from the line to return, by using the
size parameter.
Syntax
file.readline(size)
Parameters
| Parameter | Description |
|---|---|
size |
Optional. The number of bytes from the line to return. Default -1, which means the whole line. |
Return Value
The line content.
Example
Using the readline() method:
Output
Click Run to execute your code
Enjoying these tutorials?