Home »
MCQs »
Python MCQs
Amongst which of the following is / are needed to open an existing file?
63. Amongst which of the following is / are needed to open an existing file?
- filename
- mode
- Both A and B
- None of the mentioned above
Answer: C) Both A and B
Explanation:
In most cases, only the filename and mode parameters are required, with the rest of the parameters implicitly set to their default values.
Following code demonstrates the example of how to open a file -
f = open ("file.txt")