From 70e1169fe752340e105cc7f3e75a76581cefa906 Mon Sep 17 00:00:00 2001 From: Olivier Mangin Date: Fri, 14 Apr 2017 19:04:48 -0400 Subject: [PATCH] Simplifies test if binary mode. --- pubs/content.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pubs/content.py b/pubs/content.py index df646ac..f1320a9 100644 --- a/pubs/content.py +++ b/pubs/content.py @@ -50,10 +50,10 @@ def system_path(path): def _open(path, mode): - if mode.find('b') == -1: - return open(system_path(path), mode, encoding='utf-8') - else: - return open(system_path(path), mode) + if 'b' in mode: + return open(system_path(path), mode, encoding='utf-8') + else: + return open(system_path(path), mode) def check_file(path, fail=True):