1.

How do you close a file object (fp)?(a) close(fp)(b) fclose(fp)(c) fp.close()(d) fp.__close__()I had been asked this question in a job interview.My question is taken from Files topic in portion Regular Expressions and Files of Python

Answer»

Right CHOICE is (c) fp.close()

The EXPLANATION is: close() is a method of the FILE object.



Discussion

No Comment Found

Related InterviewSolutions