From c53e09413b0bc737ee510ec5aa18a6ec7406957d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Bartoszkiewicz?= Date: Wed, 5 Oct 2011 20:12:53 +0200 Subject: [PATCH] =?utf8?q?U=C5=BCycie=20with=20z=20open.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- man-symlinker.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/man-symlinker.py b/man-symlinker.py index 91a31ed..b4ef047 100755 --- a/man-symlinker.py +++ b/man-symlinker.py @@ -17,13 +17,13 @@ def process_file(name): return False category = m.group(1) dir_name = 'man' + category - f = open(name, 'r') - s = f.read(MAX_LEN+1) - if len(s) > MAX_LEN: - return False - s = s.strip() - if '\n' in s: - return False + with open(name, 'r') as f: + s = f.read(MAX_LEN+1) + if len(s) > MAX_LEN: + return False + s = s.strip() + if '\n' in s: + return False m = SO_RE.search(s) if not m: return False -- 2.45.2