Function Details: readlines

Description


Read and return a list of lines from the stream.


Extended Description


The readlines() method reads all the lines of a file and returns them as a list of strings. Each string in the list represents a single line from the file, including the newline character. If a hint is specified, it reads approximately that many bytes before returning the list.


Function Signature



Module: io

Class: TextIOWrapper

Parameters



Parameter List


  • hint: int

Return


Returns a list of strings, each representing a line from the file.


Return Type


List[str]

Output

Explanation

This example demonstrates the basic usage of readlines(). It reads all lines from the file into a list.