.readline()
The .readline()
returns the first line of content from an open file.
Syntax
file.readline()
Example
Use .readline()
to read the first line of content from the gullivers_travels.txt file:
f = open("gullivers_travels.txt", "r", encoding='utf8')f.readline()
Contributors
- Anonymous contributors