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 = open("lyrics.txt","r")
try :
line = inputFile.readline(
words = line.split()
print(words)
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.
 Python's error handling process includes the finally clause. In the following

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!