Correct syntax of file.writelines() is? A. file.writelines(sequence)

correct-syntax-of-file-writelines-is-a-file-writelines-sequence

Correct syntax of file.writelines() is?

A. file.writelines(sequence)

B. fileObject.writelines()

C. fileObject.writelines(sequence)

D. none of the mentioned

I have been asked this question in a national level competition.

I need to ask this question from Files in chapter Regular Expressions and Files of Python

Right answer is C. fileObject.writelines(sequence)

The best I can explain: The method writelines() writes a sequence of strings to the file. The sequence can be any iterable object producing strings, typically a list of strings. There is no return value.

Syntax

Following is the syntax for writelines() method:

fileObject.writelines( sequence ).