question about file handling with "with"

Jabba Laci jabba.laci at gmail.com
Wed Mar 28 05:31:21 EDT 2012


Hi,

Is the following function correct? Is the input file closed in order?

def read_data_file(self):
    with open(self.data_file) as f:
        return json.loads(f.read())

Thanks,

Laszlo



More information about the Python-list mailing list