Python - Context Managers
Which of the following is the correct syntax to open a file for reading using automatic resource cleanup?
with syntaxwith, followed by the resource expression, then as and a variable.with open('file.txt', 'r') as f:15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions