Is calling `close()` redundant if file opened with `with` statement

Viewed 84

Assume I have the following code:

with open('somefile.txt') as my_file:
    # some processing
    my_file.close()

Is my_file.close() above redundant?

4 Answers
Related