Results for “python string replace function site:docs.python.org code”
docs.python.org
Regular expression HOWTO — Python 3.15.2 documentation
If replacement is a function, the function is called for every non-overlapping occurrence of pattern. On each call, the function is passed a match object argument for the match and can use this information to compute the desired replacement string and return it.
docs.python.org
re — Regular expression operations — Python 3.15.2 documentation
This collides with Python's usage of the same character for the same purpose in string literals; for example, to match a literal backslash, one might have to ...
docs.python.org
Built-in Types — Python 3.12.16 documentation
Text Sequence Type — str ¶. Textual data in Python is handled with str objects, or strings. Strings are immutable sequences of Unicode code points. String literals are written in a variety of ways: Single quotes: 'allows embedded "double" quotes'.
docs.python.org
Built-in functions — Python 3.15.2 documentation
Code objects can be executed by exec() or eval() . source can either be a normal string, a byte string, or an AST object. Refer to the ast module documentation ...
docs.python.org
Built-in Functions — Python 3.14.2 documentation
The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.This function supports dynamic execution of Python code. source must be either a string or a code object.
docs.python.org
functools — Higher-order functions and operations on callable ...
Source code: Lib/functools.py The functools module is for higher ... This behaves like a normal Python function when used as a method: the self ...
docs.python.org
textwrap — Text wrapping and filling — Python 3.15.2 documentation
Source code: Lib/textwrap.py The textwrap module provides some convenience functions, as well as TextWrapper, the class that does all the work.