file.readable() Is readable
Last updated: 2026-09-22
file.readable() Is readable
file.readable() returns whether the file supports reading.
| Category | File Methods |
|---|---|
| Kind | Built-in Type Method |
| Python Version | all |
📝 Syntax
file.readable()
Returns:bool. True if the file supports reading, else False.
Mutates the original:No (returns a new object)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
False
True
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat does readable() check?
AWhether the file object supports reading. A file opened in 'w' mode returns False.
QWhat is it useful for?
AChecking before reading to avoid I/O errors.
QIs a file opened with 'r' always readable?
AYes; 'r' and 'r+' return True, while write modes such as 'w' and 'a' return False.