1.

Correct syntax of file.writelines() is?(a) file.writelines(sequence)(b) fileObject.writelines()(c) fileObject.writelines(sequence)(d) none of the mentionedI 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

Answer»

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 ).



Discussion

No Comment Found

Related InterviewSolutions