Do a series of global replacements on a string.
(text, *pairs)
| 196 | inspect.istraceback(object) or inspect.iscode(object)) |
| 197 | |
| 198 | def 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 | |
| 205 | def cram(text, maxlen): |
| 206 | """Omit part of a string if needed to make it fit in a maximum length.""" |
no test coverage detected
searching dependent graphs…