File to dict

Neil Cerutti horpner at yahoo.com
Fri Dec 7 09:36:07 EST 2007


On 2007-12-07, Duncan Booth <duncan.booth at invalid.invalid> wrote:
> from __future__ import with_statement
>
> def loaddomainowners(domain):
>     with open('/etc/virtual/domainowners','r') as infile:

I've been thinking I have to use contextlib.closing for
auto-closing files. Is that not so?

-- 
Neil Cerutti



More information about the Python-list mailing list