diff --git a/cssutils/parse.py b/cssutils/parse.py index d8b3b4ed..79512b08 100644 --- a/cssutils/parse.py +++ b/cssutils/parse.py @@ -177,9 +177,8 @@ def parseFile( # href = u'file:' + urllib.pathname2url(os.path.abspath(filename)) href = path2url(filename) - f = open(filename, 'rb') - css = f.read() - f.close() + with open(filename, 'rb') as fd: + css = fd.read() return self.parseString( css,