Home >>Python File Methods >Python File readable() Method

Python File readable() Method

Python File readable() Method

The readable() method is used to check whether a file stream is readable returns true otherwise return false in python.

Syntax:
file.readable()
Here is an Example of Python File readable() Method:

a= open("file1.txt", "r")
print(a.readable())

Output:
True
Example 2:

b= open("file2.txt", "r")
print(b.readable())

Output:
True

No Sidebar ads