Definition
The readline() method returns one line from the file. You can also specify 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. |
Examples:
f = open("myFile.txt", "r")
print(f.readline())