Python - Context Managers
Which of the following is the correct syntax to open a file named data.txt for reading using with?
?
Which of the following is the correct syntax to open a file named data.txt for reading using with?
?
open syntaxopen(filename, 'r').with statement syntaxwith statement requires with open(...) as variable: format.with open syntax = with open('data.txt', 'r') as file: [OK]with open(filename, 'r') as var: [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions