diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-11-22 18:32:49 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-11-22 18:32:49 +0200 |
commit | 2ab7f63d39dc3aa8602091ed0f11e7448d48e605 (patch) | |
tree | 6e0a87eef7a3021b01a89dea5f63f6e6917e763d | |
parent | 4d6789a71655d5a650cebdc365dced66cf005aac (diff) | |
download | jt-2ab7f63d39dc3aa8602091ed0f11e7448d48e605.tar.gz |
Use with open() instead of open/close explicitly
-rwxr-xr-x | jt | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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): |