Commit e2197a48 authored by Nick Coghlan's avatar Nick Coghlan

Merge issue #21667 from 3.4

parents f2d95263 1462786f
...@@ -285,16 +285,17 @@ Sequences ...@@ -285,16 +285,17 @@ Sequences
single: integer single: integer
single: Unicode single: Unicode
A string is a sequence of values that represent Unicode codepoints. 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::
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment