MCPcopy Index your code
hub / github.com/python/cpython / replace

Function replace

Lib/pydoc.py:198–203  ·  view source on GitHub ↗

Do a series of global replacements on a string.

(text, *pairs)

Source from the content-addressed store, hash-verified

196 inspect.istraceback(object) or inspect.iscode(object))
197
198def replace(text, *pairs):
199 """Do a series of global replacements on a string."""
200 while pairs:
201 text = pairs[1].join(text.split(pairs[0]))
202 pairs = pairs[2:]
203 return text
204
205def cram(text, maxlen):
206 """Omit part of a string if needed to make it fit in a maximum length."""

Callers 4

escapeMethod · 0.70
repr_stringMethod · 0.70
preformatMethod · 0.70
repr_stringMethod · 0.70

Calls 2

joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…