summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2014-11-22 18:32:49 +0200
committerLars Wirzenius <liw@liw.fi>2014-11-22 18:32:49 +0200
commit2ab7f63d39dc3aa8602091ed0f11e7448d48e605 (patch)
tree6e0a87eef7a3021b01a89dea5f63f6e6917e763d
parent4d6789a71655d5a650cebdc365dced66cf005aac (diff)
downloadjt-2ab7f63d39dc3aa8602091ed0f11e7448d48e605.tar.gz
Use with open() instead of open/close explicitly
-rwxr-xr-xjt5
1 files changed, 2 insertions, 3 deletions
diff --git a/jt b/jt
index 4dcd6d6..5390883 100755
--- a/jt
+++ b/jt
@@ -80,9 +80,8 @@ class NewCommand(Command):
'title': title,
'date': time.strftime('%Y-%m-%d %H:%M')
}
- f = open(name, 'w')
- f.write(template % values)
- f.close()
+ with open(name, 'w') as f:
+ f.write(template % values)
class ListCommand(Command):