How does readline() know where each line is im Python Programming Language?
- Inside readline() is code that scans each bytes of the file until it finds a \n character, then stops reading the file to return what it found so far.
- The file f is responsible for maintaining the current position in the file after each readline() call, so that it will keep reading each line.
Top comments (0)