Home »
MCQs »
Python MCQs
The write() method takes a string as an argument and ___
67. The write() method takes a string as an argument and ___.
- writes it to the text file
- read from the text file
- append in a text file
- None of the mentioned above
Answer: A) writes it to the text file
Explanation:
The write() method accepts a string as an argument and writes it to the text file specified by the filename parameter. The write() method returns the number of characters that were written during a single execution of the write() function. A newline character (n) must also be added at the end of every sentence to indicate the end of a line.