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

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.