From 8e721cd3bcade4fb526d2f7a1d8b02f3fba6bdf5 Mon Sep 17 00:00:00 2001 From: schneefux Date: Thu, 11 Sep 2014 14:58:39 +0200 Subject: Use `with` statement in client.g2p --- client/g2p.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/g2p.py b/client/g2p.py index 057757e..3225c73 100644 --- a/client/g2p.py +++ b/client/g2p.py @@ -43,9 +43,8 @@ def translateFile(input_filename, output_filename=None): if output_filename: out = '\n'.join(out) - f = open(output_filename, "wb") - f.write(out) - f.close() + with open(output_filename, "wb") as f: + f.write(out) return None -- cgit v1.3.1