THE WORLD'S LARGEST WEB DEVELOPER SITE

Python File writable() Method

❮ File Methods


Example

Check if the file is writable:

f = open("demofile.txt", "a")
print(f.writable())
Run example »

Definition and Usage

The writable() method returns True if the file is writable, False if not.

A file is writable if it is opened using "a" for append or "w" for write.


Syntax

file.writable()

Parameter Values

No parameters.


❮ File Methods