Published May 10, 2021Updated Apr 12, 2022
Contribute to Docs
.readline() returns the first line of content from an open file.
.readline() to read the first line of content from the gullivers_travels.txt file:
f = open("gullivers_travels.txt", "r", encoding='utf8')f.readline()
- Anonymous contributorsAnonymous contributors
- Anonymous contributors
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
Computer ScienceLooking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
Includes 6 Courses
With Professional Certification