Python - File Reading and Writing Strategies
Which of the following is the correct way to open a file and read its entire content safely in Python?
with open(...) ensures the file is closed automatically after reading, which is safer.with block, file.read() reads the whole file content as a string.with open() + read() for safe full read [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions