Skip to content

Commit 5044c22

Browse files
csabellaezio-melottiarhadthedevwillingc
authored
gh-67748: DOC:Add summary table for str methods in stdtypes.rst (GH-1709)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
1 parent aa6579c commit 5044c22

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,6 +1548,100 @@ objects that compare equal might have different :attr:`~range.start`,
15481548
single: str (built-in class); (see also string)
15491549
pair: object; string
15501550

1551+
.. _text-methods-summary:
1552+
1553+
Text and Binary Sequence Type Methods Summary
1554+
=============================================
1555+
The following table summarizes the text and binary sequence types methods by
1556+
category.
1557+
1558+
1559+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1560+
| Category | :class:`str` methods | :class:`bytes` and :class:`bytearray` methods |
1561+
+==========================+===========================================+===================================================+
1562+
| Formatting | :meth:`str.format` | |
1563+
| +-------------------------------------------+---------------------------------------------------+
1564+
| | :meth:`str.format_map` | |
1565+
| +-------------------------------------------+---------------------------------------------------+
1566+
| | :ref:`f-strings` | |
1567+
| +-------------------------------------------+---------------------------------------------------+
1568+
| | :ref:`old-string-formatting` | :ref:`bytes-formatting` |
1569+
+--------------------------+------------------+------------------------+--------------------+------------------------------+
1570+
| Searching and Replacing | :meth:`str.find` | :meth:`str.rfind` | :meth:`bytes.find` | :meth:`bytes.rfind` |
1571+
| +------------------+------------------------+--------------------+------------------------------+
1572+
| | :meth:`str.index`| :meth:`str.rindex` | :meth:`bytes.index`| :meth:`bytes.rindex` |
1573+
| +------------------+------------------------+--------------------+------------------------------+
1574+
| | :meth:`str.startswith` | :meth:`bytes.startswith` |
1575+
| +-------------------------------------------+---------------------------------------------------+
1576+
| | :meth:`str.endswith` | :meth:`bytes.endswith` |
1577+
| +-------------------------------------------+---------------------------------------------------+
1578+
| | :meth:`str.count` | :meth:`bytes.count` |
1579+
| +-------------------------------------------+---------------------------------------------------+
1580+
| | :meth:`str.replace` | :meth:`bytes.replace` |
1581+
+--------------------------+-------------------+-----------------------+---------------------+-----------------------------+
1582+
| Splitting and Joining | :meth:`str.split` | :meth:`str.rsplit` | :meth:`bytes.split` | :meth:`bytes.rsplit` |
1583+
| +-------------------+-----------------------+---------------------+-----------------------------+
1584+
| | :meth:`str.splitlines` | :meth:`bytes.splitlines` |
1585+
| +-------------------------------------------+---------------------------------------------------+
1586+
| | :meth:`str.partition` | :meth:`bytes.partition` |
1587+
| +-------------------------------------------+---------------------------------------------------+
1588+
| | :meth:`str.rpartition` | :meth:`bytes.rpartition` |
1589+
| +-------------------------------------------+---------------------------------------------------+
1590+
| | :meth:`str.join` | :meth:`bytes.join` |
1591+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1592+
| String Classification | :meth:`str.isalpha` | :meth:`bytes.isalpha` |
1593+
| +-------------------------------------------+---------------------------------------------------+
1594+
| | :meth:`str.isdecimal` | |
1595+
| +-------------------------------------------+---------------------------------------------------+
1596+
| | :meth:`str.isdigit` | :meth:`bytes.isdigit` |
1597+
| +-------------------------------------------+---------------------------------------------------+
1598+
| | :meth:`str.isnumeric` | |
1599+
| +-------------------------------------------+---------------------------------------------------+
1600+
| | :meth:`str.isalnum` | :meth:`bytes.isalnum` |
1601+
| +-------------------------------------------+---------------------------------------------------+
1602+
| | :meth:`str.isidentifier` | |
1603+
| +-------------------------------------------+---------------------------------------------------+
1604+
| | :meth:`str.islower` | :meth:`bytes.islower` |
1605+
| +-------------------------------------------+---------------------------------------------------+
1606+
| | :meth:`str.isupper` | :meth:`bytes.isupper` |
1607+
| +-------------------------------------------+---------------------------------------------------+
1608+
| | :meth:`str.istitle` | :meth:`bytes.istitle` |
1609+
| +-------------------------------------------+---------------------------------------------------+
1610+
| | :meth:`str.isspace` | :meth:`bytes.isspace` |
1611+
| +-------------------------------------------+---------------------------------------------------+
1612+
| | :meth:`str.isprintable` | |
1613+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1614+
| Case Manipulation | :meth:`str.lower` | :meth:`bytes.lower` |
1615+
| +-------------------------------------------+---------------------------------------------------+
1616+
| | :meth:`str.upper` | :meth:`bytes.upper` |
1617+
| +-------------------------------------------+---------------------------------------------------+
1618+
| | :meth:`str.casefold` | |
1619+
| +-------------------------------------------+---------------------------------------------------+
1620+
| | :meth:`str.capitalize` | :meth:`bytes.capitalize` |
1621+
| +-------------------------------------------+---------------------------------------------------+
1622+
| | :meth:`str.title` | :meth:`bytes.title` |
1623+
| +-------------------------------------------+---------------------------------------------------+
1624+
| | :meth:`str.swapcase` | :meth:`bytes.swapcase` |
1625+
+--------------------------+-------------------+-----------------------+---------------------+-----------------------------+
1626+
| Padding and Stripping | :meth:`str.ljust` | :meth:`str.rjust` | :meth:`bytes.ljust` | :meth:`bytes.rjust` |
1627+
| +-------------------+-----------------------+---------------------+-----------------------------+
1628+
| | :meth:`str.center` | :meth:`bytes.center` |
1629+
| +-------------------------------------------+---------------------------------------------------+
1630+
| | :meth:`str.expandtabs` | :meth:`bytes.expandtabs` |
1631+
| +-------------------------------------------+---------------------------------------------------+
1632+
| | :meth:`str.strip` | :meth:`bytes.strip` |
1633+
| +--------------------+----------------------+----------------------+----------------------------+
1634+
| | :meth:`str.lstrip` | :meth:`str.rstrip` | :meth:`bytes.lstrip` | :meth:`bytes.rstrip` |
1635+
+--------------------------+--------------------+----------------------+----------------------+----------------------------+
1636+
| Translation and Encoding | :meth:`str.translate` | :meth:`bytes.translate` |
1637+
| +-------------------------------------------+---------------------------------------------------+
1638+
| | :meth:`str.maketrans` | :meth:`bytes.maketrans` |
1639+
| +-------------------------------------------+---------------------------------------------------+
1640+
| | :meth:`str.encode` | |
1641+
| +-------------------------------------------+---------------------------------------------------+
1642+
| | | :meth:`bytes.decode` |
1643+
+--------------------------+-------------------------------------------+---------------------------------------------------+
1644+
15511645
.. _textseq:
15521646

15531647
Text Sequence Type --- :class:`str`

0 commit comments

Comments
 (0)