Python File writable() Method

Example

Check if the file is writable:

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

Run Instance

Definition and Usage

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

If a file is opened with 'a' for appending or 'w' for writing, then the file is writable.

Syntax

file.writable()

Parameter Value

No parameters.