summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCheryl Sabella <cheryl.sabella@gmail.com>2025-01-13 13:14:59 (GMT)
committerGitHub <noreply@github.com>2025-01-13 13:14:59 (GMT)
commit5044c2245c1519e117ba3977a4c8f608785326e7 (patch)
tree0c55ba301ea567f7dce964ec53feb96bb4be1149
parentaa6579cb60b4fcd652d7bc83fed2668e4ae84db3 (diff)
downloadcpython-5044c2245c1519e117ba3977a4c8f608785326e7.zip
cpython-5044c2245c1519e117ba3977a4c8f608785326e7.tar.gz
cpython-5044c2245c1519e117ba3977a4c8f608785326e7.tar.bz2
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>
-rw-r--r--Doc/library/stdtypes.rst94
1 files changed, 94 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 1918275..6050784 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1548,6 +1548,100 @@ objects that compare equal might have different :attr:`~range.start`,
single: str (built-in class); (see also string)
pair: object; string
+.. _text-methods-summary:
+
+Text and Binary Sequence Type Methods Summary
+=============================================
+The following table summarizes the text and binary sequence types methods by
+category.
+
+
++--------------------------+-------------------------------------------+---------------------------------------------------+
+| Category | :class:`str` methods | :class:`bytes` and :class:`bytearray` methods |
++==========================+===========================================+===================================================+
+| Formatting | :meth:`str.format` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.format_map` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | :ref:`f-strings` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | :ref:`old-string-formatting` | :ref:`bytes-formatting` |
++--------------------------+------------------+------------------------+--------------------+------------------------------+
+| Searching and Replacing | :meth:`str.find` | :meth:`str.rfind` | :meth:`bytes.find` | :meth:`bytes.rfind` |
+| +------------------+------------------------+--------------------+------------------------------+
+| | :meth:`str.index`| :meth:`str.rindex` | :meth:`bytes.index`| :meth:`bytes.rindex` |
+| +------------------+------------------------+--------------------+------------------------------+
+| | :meth:`str.startswith` | :meth:`bytes.startswith` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.endswith` | :meth:`bytes.endswith` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.count` | :meth:`bytes.count` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.replace` | :meth:`bytes.replace` |
++--------------------------+-------------------+-----------------------+---------------------+-----------------------------+
+| Splitting and Joining | :meth:`str.split` | :meth:`str.rsplit` | :meth:`bytes.split` | :meth:`bytes.rsplit` |
+| +-------------------+-----------------------+---------------------+-----------------------------+
+| | :meth:`str.splitlines` | :meth:`bytes.splitlines` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.partition` | :meth:`bytes.partition` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.rpartition` | :meth:`bytes.rpartition` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.join` | :meth:`bytes.join` |
++--------------------------+-------------------------------------------+---------------------------------------------------+
+| String Classification | :meth:`str.isalpha` | :meth:`bytes.isalpha` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isdecimal` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isdigit` | :meth:`bytes.isdigit` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isnumeric` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isalnum` | :meth:`bytes.isalnum` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isidentifier` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.islower` | :meth:`bytes.islower` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isupper` | :meth:`bytes.isupper` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.istitle` | :meth:`bytes.istitle` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isspace` | :meth:`bytes.isspace` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.isprintable` | |
++--------------------------+-------------------------------------------+---------------------------------------------------+
+| Case Manipulation | :meth:`str.lower` | :meth:`bytes.lower` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.upper` | :meth:`bytes.upper` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.casefold` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.capitalize` | :meth:`bytes.capitalize` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.title` | :meth:`bytes.title` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.swapcase` | :meth:`bytes.swapcase` |
++--------------------------+-------------------+-----------------------+---------------------+-----------------------------+
+| Padding and Stripping | :meth:`str.ljust` | :meth:`str.rjust` | :meth:`bytes.ljust` | :meth:`bytes.rjust` |
+| +-------------------+-----------------------+---------------------+-----------------------------+
+| | :meth:`str.center` | :meth:`bytes.center` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.expandtabs` | :meth:`bytes.expandtabs` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.strip` | :meth:`bytes.strip` |
+| +--------------------+----------------------+----------------------+----------------------------+
+| | :meth:`str.lstrip` | :meth:`str.rstrip` | :meth:`bytes.lstrip` | :meth:`bytes.rstrip` |
++--------------------------+--------------------+----------------------+----------------------+----------------------------+
+| Translation and Encoding | :meth:`str.translate` | :meth:`bytes.translate` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.maketrans` | :meth:`bytes.maketrans` |
+| +-------------------------------------------+---------------------------------------------------+
+| | :meth:`str.encode` | |
+| +-------------------------------------------+---------------------------------------------------+
+| | | :meth:`bytes.decode` |
++--------------------------+-------------------------------------------+---------------------------------------------------+
+
.. _textseq:
Text Sequence Type --- :class:`str`