Python Programming - Reading and Writing Files - Discussion

Discussion Forum : Reading and Writing Files - General Questions (Q.No. 93)
93.
How can you check if a file named "output.txt" is writable?
if is_writable("output.txt"):
if file.can_write("output.txt"):
if os.access("output.txt", os.W_OK):
if check_writable("output.txt"):
Answer: Option
Explanation:
Using os.access() with the os.W_OK flag to check if the file is writable.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.