Does filehandle get closed automatically in Python after it goes out of scope?
- by bodacydo
If I do the following, does filehandle get closed automatically as it goes out of scope in Python:
def read_contents(file_path):
return file(file_path).read()
If it doesn't, how can I write this function to close the scope automatically?