Function Details: readable

Description


Return True if the file stream can be read from.


Extended Description


The readable() method checks whether the file stream is readable. It returns True if the stream can be read from, and False otherwise. This is useful for determining if operations like read() or readline() can be performed on the file.


Function Signature



Module: io

Class: TextIOWrapper

Parameters



Return


Returns True if the file is readable, False otherwise.


Return Type


bool

Output

Explanation

This example demonstrates the basic usage of readable(). For a file opened in read mode, it will return True.