English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Python basic tutorial

Python flow control

Fonctions en Python

Types de données en Python

Python file operations

Python objects and classes

Python date and time

Advanced Python knowledge

Python reference manual

Python file writeable() usage and examples

Python File (File) method

Overview

writeable() The method checks if the file is writable.

Syntax

The syntax of the writeable() method is as follows:

file.writable()

Parameters

  • No parameters.

Return value

If the file is writable, the writable() method returns True, otherwise it returns False.
If a file is opened with "a" for appending or with "w" for writing, then the file is writable.

Example

The following example demonstrates the use of the writable() method:

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

The output result of the above example is as follows:

True

 Python File (File) method