Skip to content

Commit 937e8dd

Browse files
committed
bpo-23560: DOC:Add summary table for str methods in stdtypes.rst
1 parent cdb89cd commit 937e8dd

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,108 @@ objects that compare equal might have different :attr:`~range.start`,
13761376
single: str (built-in class); (see also string)
13771377
object: string
13781378

1379+
.. _text-methods-summary:
1380+
1381+
Text and Binary Sequence Type Methods Summary
1382+
=============================================
1383+
The following table summarizes the text and binary sequence types methods by
1384+
category.
1385+
1386+
1387+
+--------------------------+------------------------------+------------------------------+
1388+
| Category | str methods | bytes methods |
1389+
+==========================+==============================+==============================+
1390+
| Formatting | :meth:`str.format` | |
1391+
+ +------------------------------+------------------------------+
1392+
| | :meth:`str.format_map` | |
1393+
+--------------------------+------------------------------+------------------------------+
1394+
| Searching and Replacing | :meth:`str.find` | :meth:`bytes.find` |
1395+
+ +------------------------------+------------------------------+
1396+
| | :meth:`str.rfind` | :meth:`bytes.rfind` |
1397+
+ +------------------------------+------------------------------+
1398+
| | :meth:`str.index` | :meth:`bytes.index` |
1399+
+ +------------------------------+------------------------------+
1400+
| | :meth:`str.rindex` | :meth:`bytes.rindex` |
1401+
+ +------------------------------+------------------------------+
1402+
| | :meth:`str.startswith` | :meth:`bytes.startswith` |
1403+
+ +------------------------------+------------------------------+
1404+
| | :meth:`str.endswith` | :meth:`bytes.endswith` |
1405+
+ +------------------------------+------------------------------+
1406+
| | :meth:`str.count` | :meth:`bytes.count` |
1407+
+ +------------------------------+------------------------------+
1408+
| | :meth:`str.replace` | :meth:`bytes.replace` |
1409+
+--------------------------+------------------------------+------------------------------+
1410+
| Splitting and Joining | :meth:`str.split` | :meth:`bytes.split` |
1411+
+ +------------------------------+------------------------------+
1412+
| | :meth:`str.splitlines` | :meth:`bytes.splitlines` |
1413+
+ +------------------------------+------------------------------+
1414+
| | :meth:`str.rsplit` | :meth:`bytes.rsplit` |
1415+
+ +------------------------------+------------------------------+
1416+
| | :meth:`str.partition` | :meth:`bytes.partition` |
1417+
+ +------------------------------+------------------------------+
1418+
| | :meth:`str.rpartition` | :meth:`bytes.rpartition` |
1419+
+ +------------------------------+------------------------------+
1420+
| | :meth:`str.join` | :meth:`bytes.join` |
1421+
+--------------------------+------------------------------+------------------------------+
1422+
| String Classification | :meth:`str.isalpha` | :meth:`bytes.isalpha` |
1423+
+ +------------------------------+------------------------------+
1424+
| | :meth:`str.isdecimal` | |
1425+
+ +------------------------------+------------------------------+
1426+
| | :meth:`str.isdigit` | :meth:`bytes.isdigit` |
1427+
+ +------------------------------+------------------------------+
1428+
| | :meth:`str.isnumeric` | |
1429+
+ +------------------------------+------------------------------+
1430+
| | :meth:`str.isalnum` | :meth:`bytes.isalnum` |
1431+
+ +------------------------------+------------------------------+
1432+
| | :meth:`str.isidentifier` | |
1433+
+ +------------------------------+------------------------------+
1434+
| | :meth:`str.islower` | :meth:`bytes.islower` |
1435+
+ +------------------------------+------------------------------+
1436+
| | :meth:`str.isupper` | :meth:`bytes.isupper` |
1437+
+ +------------------------------+------------------------------+
1438+
| | :meth:`str.istitle` | :meth:`bytes.istitle` |
1439+
+ +------------------------------+------------------------------+
1440+
| | :meth:`str.isspace` | :meth:`bytes.isspace` |
1441+
+ +------------------------------+------------------------------+
1442+
| | :meth:`str.isprintable` | |
1443+
+--------------------------+------------------------------+------------------------------+
1444+
| Case Manipulation | :meth:`str.lower` | :meth:`bytes.lower` |
1445+
+ +------------------------------+------------------------------+
1446+
| | :meth:`str.upper` | :meth:`bytes.upper` |
1447+
+ +------------------------------+------------------------------+
1448+
| | :meth:`str.casefold` | |
1449+
+ +------------------------------+------------------------------+
1450+
| | :meth:`str.capitalize` | :meth:`bytes.capitalize` |
1451+
+ +------------------------------+------------------------------+
1452+
| | :meth:`str.title` | :meth:`bytes.title` |
1453+
+ +------------------------------+------------------------------+
1454+
| | :meth:`str.swapcase` | :meth:`bytes.swapcase` |
1455+
+--------------------------+------------------------------+------------------------------+
1456+
| Padding and Stripping | :meth:`str.ljust` | :meth:`bytes.ljust` |
1457+
+ +------------------------------+------------------------------+
1458+
| | :meth:`str.rjust` | :meth:`bytes.rjust` |
1459+
+ +------------------------------+------------------------------+
1460+
| | :meth:`str.center` | :meth:`bytes.center` |
1461+
+ +------------------------------+------------------------------+
1462+
| | :meth:`str.zfill` | :meth:`bytes.zfill` |
1463+
+ +------------------------------+------------------------------+
1464+
| | :meth:`str.expandtabs` | :meth:`bytes.expandtabs` |
1465+
+ +------------------------------+------------------------------+
1466+
| | :meth:`str.strip` | :meth:`bytes.strip` |
1467+
+ +------------------------------+------------------------------+
1468+
| | :meth:`str.lstrip` | :meth:`bytes.lstrip` |
1469+
+ +------------------------------+------------------------------+
1470+
| | :meth:`str.rstrip` | :meth:`bytes.rstrip` |
1471+
+--------------------------+------------------------------+------------------------------+
1472+
| Translation and Encoding | :meth:`str.translate` | :meth:`bytes.translate` |
1473+
+ +------------------------------+------------------------------+
1474+
| | :meth:`str.maketrans` | :meth:`bytes.maketrans` |
1475+
+ +------------------------------+------------------------------+
1476+
| | :meth:`str.encode` | |
1477+
+ +------------------------------+------------------------------+
1478+
| | | :meth:`bytes.decode` |
1479+
+--------------------------+------------------------------+------------------------------+
1480+
13791481
.. _textseq:
13801482

13811483
Text Sequence Type --- :class:`str`
@@ -1464,6 +1566,7 @@ multiple fragments.
14641566
sections. In addition, see the :ref:`stringservices` section.
14651567

14661568

1569+
14671570
.. index::
14681571
pair: string; methods
14691572

0 commit comments

Comments
 (0)