<AptiCode/>

Question 490: Which function is used to open a file for writing?

tcs
wipro
infosys
general
aptitude
standard-libraries
python-programming

To open a file for writing in Python, you use theopen()function with the mode parameter set to "w" (write). For example:file = open("file.txt", "w")