English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Python Basic Tutorial

Python Flow Control

Fonctions en Python

Types de données en Python

Python File Operations

Python Objects and Classes

Python Date and Time

Advanced Python Knowledge

Python Reference Manual

Python file readable() usage and examples

Python File (File) Method

Overview

readable() This method is used to check if the file is readable.

Syntax

readable() syntax is as follows:

fileObject.readable();

Parameters

  • No parameters.

Return value

If the file is readable, the readable() method returns True, otherwise it returns False.

Example

The following example demonstrates the use of the readable() method:

f = open("w3codebox.txt, "r")
print(f.readable())

The output result of the above example is as follows:

True

Python File (File) Method