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


Groups > comp.lang.python > #22269

question about file handling with "with"

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jabba.laci@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'subject:question': 0.08; 'subject:file': 0.09; 'order?': 0.16; 'subject:handling': 0.16; 'to:name:python mailing list': 0.16; 'thanks,': 0.19; 'def': 0.20; 'function': 0.22; 'input': 0.24; 'message-id:@mail.gmail.com': 0.27; 'subject:with': 0.28; 'file': 0.29; 'received:209.85': 0.32; 'received:google.com': 0.32; 'hi,': 0.33; 'received:209': 0.35; 'to:addr:python-list': 0.39; 'to:addr:python.org': 0.40; 'closed': 0.61; 'subject:"': 0.72
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=J4z9CzpDTIY5ICFeFiMYKqkh4e4/nRNFadGUbMC/VMM=; b=Esd4zzCC6nyC8QmvMK+g3fAO+S0QJebqJkqm7oEaUkwTOjx5jR9lGnifZAQdd3DPJI SqSaiymOE7z1DuifpesT4YG2K5kIayu6s582xnr+CqLbn0uoyaIQvAxT2ecOxDng+TxQ merDb0codgEfzEn4fjnEwqWYD2mmwkcPJkbDTVp2vfgIuGY9HV7cIJUNMXXlHr0UfDWU Kx75ukJBcvjhxiHj3EGkmGN9QPBaUm57z4nP+XK09h33wy11ifE9BqCggFhiqiOm/fAs RtchgF+BPaJvLAwbE6Xxldv+Ow3zQJ1sCD58BhGCox+SjvuGpJ61wubt0mS50WKfJhrS IRgg==
MIME-Version 1.0
From Jabba Laci <jabba.laci@gmail.com>
Date Wed, 28 Mar 2012 11:31:21 +0200
Subject question about file handling with "with"
To Python mailing list <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1067.1332927106.3037.python-list@python.org> (permalink)
Lines 11
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1332927106 news.xs4all.nl 6981 [2001:888:2000:d::a6]:48162
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:22269

Show key headers only | 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