Home >>Python File Methods >Python File writable() Method

Python File writable() Method

Python File writable() Method

Python File writable() Method is an inbuilt method in python and is used to check whether the specified file stream is writable or not in python. If the specified file is writable, it returns true, else returns false.

Syntax:
file.writable()
Here is an example of Python File writable() Method:

z = open("file1.txt", "a")
print(z.writable())

Output:
True
Example 2:

e = open("file2.txt", "a")
print(e.writable())

Output:
True

No Sidebar ads