1.

What is the use of “w” in file handling?(a) Read(b) Write(c) Append(d) None of the mentionedThe question was asked during a job interview.The above asked question is from Files topic in division Regular Expressions and Files of Python

Answer» RIGHT choice is (b) Write

The BEST I can EXPLAIN: This opens the file for writing. It will create the file if it doesn’t exist, and if it does, it will overwrite it.

fh = open(“filename_here”, “w”).


Discussion

No Comment Found

Related InterviewSolutions