diff options
Diffstat (limited to '')
-rw-r--r-- | vk/tracking/db/io.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/vk/tracking/db/io.py b/vk/tracking/db/io.py index 805334d..d280634 100644 --- a/vk/tracking/db/io.py +++ b/vk/tracking/db/io.py @@ -36,8 +36,12 @@ def _open_file(path=None, default=None, **kwargs): if fd is not default: fd.close() -def open_output_text_file(path=None): - return _open_file(path, default=sys.stdout, mode='w', encoding='utf-8') +_DEFAULT_ENCODING = 'utf-8' + +def open_output_text_file(path=None, mode='w'): + return _open_file(path, default=sys.stdout, mode=mode, + encoding=_DEFAULT_ENCODING) def open_input_text_file(path=None): - return _open_file(path, default=sys.stdin, mode='r', encoding='utf-8') + return _open_file(path, default=sys.stdin, mode='r', + encoding=_DEFAULT_ENCODING) |