Home »
MCQs »
Python MCQs
Python always makes sure that any unwritten or unsaved data is written to the file before it is closed?
66. Python always makes sure that any unwritten or unsaved data is written to the file before it is closed?
- True
- False
Answer: A) True
Explanation:
Whenever a file is closed, Python ensures that any unwritten or unsaved data is flushed out or written to the file's header before the file is closed. As a result, it is always recommended that we close the file once our work is completed. Additionally, if the file object is reassigned to a different file, the previous file is automatically closed as well.