Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python file writable() method is used to check whether the specified file is writable or not. It returns true if the specified file is writable, else returns false.

Syntax

file.writable()

Parameters

No parameter is required.

Return Value

Returns True if the file is writable, else returns False.

Example: Check a file, writable or not

In the below example, Python file writable() method is used to check whether the file called MyFile is writable or not.

MyFile = open("python_test.txt")
print(MyFile.writable())

The output of the above code will be:

False

❮ Python File Handling Methods