File.close() no response
I executed file.close and did not get the response in the video.
Why is this please?
1 answers ( 0 marked as helpful)
Hi Olanike!
The close()
function doesn't produce an immediate visible output. It acts as closing the current file. To confirm if the file has been successfully closed, you can utilize the closed
attribute subsequently (as it's been done in the lesson). Checking this attribute will yield an output True
, indicating that the file is indeed closed.
So, you need to apply:
file.close()
- to close the file
and then:
file.closed
- to check the status of the file.
Hope this helps.
Best,
Ivan