mirror of
https://github.com/python/cpython.git
synced 2026-07-31 22:25:29 -04:00
[3.13] gh-48181: Document codecs.charmap_build (GH-135997) (#136124)
gh-48181: Document `codecs.charmap_build` (GH-135997)
(cherry picked from commit 2bdd50309f)
Co-authored-by: Stan Ulbrych <[email protected]>
This commit is contained in:
co-authored by
Stan Ulbrych
parent
ad5f88eafa
commit
ef4a70b63f
@@ -53,6 +53,14 @@ any codec:
|
||||
:exc:`UnicodeDecodeError`). Refer to :ref:`codec-base-classes` for more
|
||||
information on codec error handling.
|
||||
|
||||
.. function:: charmap_build(string)
|
||||
|
||||
Return a mapping suitable for encoding with a custom single-byte encoding.
|
||||
Given a :class:`str` *string* of up to 256 characters representing a
|
||||
decoding table, returns either a compact internal mapping object
|
||||
``EncodingMap`` or a :class:`dictionary <dict>` mapping character ordinals
|
||||
to byte values. Raises a :exc:`TypeError` on invalid input.
|
||||
|
||||
The full details for each codec can also be looked up directly:
|
||||
|
||||
.. function:: lookup(encoding)
|
||||
|
||||
Reference in New Issue
Block a user