mirror of
https://github.com/python/cpython.git
synced 2025-11-01 06:01:29 +00:00
gh-137668: Document that ord() supports also bytes and bytearray (GH-137669)
This commit is contained in:
parent
639df39bf0
commit
35759fe2fa
3 changed files with 27 additions and 9 deletions
|
|
@ -1562,13 +1562,19 @@ are always available. They are listed here in alphabetical order.
|
|||
.. versionchanged:: 3.11
|
||||
The ``'U'`` mode has been removed.
|
||||
|
||||
.. function:: ord(c)
|
||||
.. function:: ord(character, /)
|
||||
|
||||
Given a string representing one Unicode character, return an integer
|
||||
representing the Unicode code point of that character. For example,
|
||||
Return the ordinal value of a character.
|
||||
|
||||
If the argument is a one-character string, return the Unicode code point
|
||||
of that character. For example,
|
||||
``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign)
|
||||
returns ``8364``. This is the inverse of :func:`chr`.
|
||||
|
||||
If the argument is a :class:`bytes` or :class:`bytearray` object of
|
||||
length 1, return its single byte value.
|
||||
For example, ``ord(b'a')`` returns the integer ``97``.
|
||||
|
||||
|
||||
.. function:: pow(base, exp, mod=None)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue