Question: Python's error handling process includes the finally clause. In the following code snippet, when is the finally clause executed? inputFile = open ( lyrics
Python's error handling process includes the finally clause. In the following code snippet, when is the finally clause executed?
inputFile openlyricstxtr
try :
line inputFile.readline
words line.split
printwords
finally :
inputFile.close
The finally clause is never executed in this example.
The finally clause is always executed in this example.
Only when there is an error opening the file.
Only when there is an error reading the file.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
