Python Programming - Standard Libraries - Discussion

Discussion Forum : Standard Libraries - General Questions (Q.No. 3)
3.
Which function is used to open a file for writing?
open("file.txt", "r")
open("file.txt", "w")
file.write()
file.read()
Answer: Option
Explanation:
To open a file for writing in Python, you use the open() function with the mode parameter set to "w" (write). For example:
file = open("file.txt", "w")
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.