mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Merge issue #21667 from 3.4
This commit is contained in:
commit
e2197a4805
1 changed files with 10 additions and 9 deletions
|
@ -286,15 +286,16 @@ Sequences
|
||||||
single: Unicode
|
single: Unicode
|
||||||
|
|
||||||
A string is a sequence of values that represent Unicode code points.
|
A string is a sequence of values that represent Unicode code points.
|
||||||
All the codepoints in range ``U+0000 - U+10FFFF`` can be represented
|
All the code points in the range ``U+0000 - U+10FFFF`` can be
|
||||||
in a string. Python doesn't have a :c:type:`chr` type, and
|
represented in a string. Python doesn't have a :c:type:`char` type;
|
||||||
every character in the string is represented as a string object
|
instead, every code point in the string is represented as a string
|
||||||
with length ``1``. The built-in function :func:`ord` converts a
|
object with length ``1``. The built-in function :func:`ord`
|
||||||
character to its codepoint (as an integer); :func:`chr` converts
|
converts a code point from its string form to an integer in the
|
||||||
an integer in range ``0 - 10FFFF`` to the corresponding character.
|
range ``0 - 10FFFF``; :func:`chr` converts an integer in the range
|
||||||
|
``0 - 10FFFF`` to the corresponding length ``1`` string object.
|
||||||
:meth:`str.encode` can be used to convert a :class:`str` to
|
:meth:`str.encode` can be used to convert a :class:`str` to
|
||||||
:class:`bytes` using the given encoding, and :meth:`bytes.decode` can
|
:class:`bytes` using the given text encoding, and
|
||||||
be used to achieve the opposite.
|
:meth:`bytes.decode` can be used to achieve the opposite.
|
||||||
|
|
||||||
Tuples
|
Tuples
|
||||||
.. index::
|
.. index::
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue