diff options
author | Georg Brandl <georg@python.org> | 2009-06-04 09:11:51 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-06-04 09:11:51 (GMT) |
commit | b54d801280e3f510782e2855504710947d10f053 (patch) | |
tree | 457166089bbc17f190eb7140755c7948e2918829 /Doc/library/base64.rst | |
parent | cef803f82c82017b734dd4264478ae6f02ce21f5 (diff) | |
download | cpython-b54d801280e3f510782e2855504710947d10f053.zip cpython-b54d801280e3f510782e2855504710947d10f053.tar.gz cpython-b54d801280e3f510782e2855504710947d10f053.tar.bz2 |
#3613: add base64.encodebytes and decodebytes as the new spelling of encodestring and decodestring; deprecate the latter.
Diffstat (limited to 'Doc/library/base64.rst')
-rw-r--r-- | Doc/library/base64.rst | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst index 62bf1d4..9ff065a 100644 --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -116,38 +116,44 @@ The modern interface provides: incorrectly padded or if there are non-alphabet characters present in the string. -The legacy interface: +The legacy interface: .. function:: decode(input, output) - Decode the contents of the *input* file and write the resulting binary data to - the *output* file. *input* and *output* must either be file objects or objects - that mimic the file object interface. *input* will be read until - ``input.read()`` returns an empty string. + Decode the contents of the binary *input* file and write the resulting binary + data to the *output* file. *input* and *output* must either be file objects + or objects that mimic the file object interface working with bytes + objects. *input* will be read until ``input.read()`` returns an empty string. -.. function:: decodestring(s) +.. function:: decodebytes(s) + decodestring(s) - Decode the string *s*, which must contain one or more lines of base64 encoded - data, and return a string containing the resulting binary data. + Decode the bytestring *s*, which must contain one or more lines of base64 + encoded data, and return a bytestring containing the resulting binary data. + ``decodestring`` is a deprecated alias. .. function:: encode(input, output) - Encode the contents of the *input* file and write the resulting base64 encoded - data to the *output* file. *input* and *output* must either be file objects or - objects that mimic the file object interface. *input* will be read until - ``input.read()`` returns an empty string. :func:`encode` returns the encoded - data plus a trailing newline character (``'\n'``). + Encode the contents of the binary *input* file and write the resulting base64 + encoded data to the *output* file. *input* and *output* must either be file + objects or objects that mimic the file object interface working with bytes + objects. *input* will be read until ``input.read()`` returns an empty string. + :func:`encode` returns the encoded data plus a trailing newline character + (``b'\n'``). + +.. function:: encodebytes(s) + encodestring(s) -.. function:: encodestring(s) + Encode the bytestring *s*, which can contain arbitrary binary data, and + return a bytestring containing one or more lines of base64-encoded data. + :func:`encodebytes` returns a string containing one or more lines of + base64-encoded data always including an extra trailing newline (``b'\n'``). + ``encodestring`` is a deprecated alias. - Encode the string *s*, which can contain arbitrary binary data, and return a - string containing one or more lines of base64-encoded data. - :func:`encodestring` returns a string containing one or more lines of - base64-encoded data always including an extra trailing newline (``'\n'``). An example usage of the module: |