Menu

[solved]-Code Added End Following Code Segment Ensure Infileis Always Closed Even Exception Thrown Q39009915

What code should be added to the end of the following codesegment to ensure that inFileis always closed, even if an exceptionis thrown in the code represented by . . . ?

inFile = open(“test.txt”, “r”)try : line = inFile.readline() . . .

Question 25 options:

A)

inFile.close()

B)

always : inFile.close()

C)

ensure : inFile.close()

D)

finally :

Expert Answer


Answer to What code should be added to the end of the following code segment to ensure that inFileis always closed, even if an exc… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *