Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22269

question about file handling with "with"

From Jabba Laci <jabba.laci@gmail.com>
Date 2012-03-28 11:31 +0200
Subject question about file handling with "with"
Newsgroups comp.lang.python
Message-ID <mailman.1067.1332927106.3037.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

question about file handling with "with" Jabba Laci <jabba.laci@gmail.com> - 2012-03-28 11:31 +0200
  Re: question about file handling with "with" Nobody <nobody@nowhere.com> - 2012-03-29 17:25 +0100

csiph-web