diff options
author | Jingxin Zhu <jz1371@nyu.edu> | 2018-01-25 21:41:08 -0800 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2018-01-25 21:41:08 -0800 |
commit | db3d0d678b422614d5de0f9ed76a2112a28c7b19 (patch) | |
tree | 2e163adc4c12d998ff56c28870e5b2189d565cc6 /documentation | |
parent | 5fb43eb68b7edaedb08589dfa7229e717a78642d (diff) | |
download | six-git-db3d0d678b422614d5de0f9ed76a2112a28c7b19.tar.gz |
add ensure_binary/str/text helper functions (#204)
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/index.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/documentation/index.rst b/documentation/index.rst index 68b2fd7..86c3a03 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -433,6 +433,24 @@ string data in all Python versions. a bytes object iterator in Python 3. +.. function:: ensure_binary(s, encoding='utf-8', errors='strict') + + A helper function to ensure output is :data:`binary_type`. ``encoding``, ``errors`` + are the same as :meth:`py3:str.encode` + + +.. function:: ensure_str(s, encoding='utf-8', errors='strict') + + A helper function to ensure output is ``str``. ``encoding``, ``errors`` + are the same :meth:`py3:str.encode` + + +.. function:: ensure_text(s, encoding='utf-8', errors='strict') + + A helper function to ensure output is :data:`text_type`. ``encoding``, ``errors`` + are the same as :meth:`py3:str.encode` + + .. data:: StringIO This is a fake file object for textual data. It's an alias for |