Do a series of global replacements on a string.
(text, *pairs)
| 224 | inspect.istraceback(object) or inspect.iscode(object)) |
| 225 | |
| 226 | def replace(text, *pairs): |
| 227 | """Do a series of global replacements on a string.""" |
| 228 | while pairs: |
| 229 | text = pairs[1].join(text.split(pairs[0])) |
| 230 | pairs = pairs[2:] |
| 231 | return text |
| 232 | |
| 233 | def cram(text, maxlen): |
| 234 | """Omit part of a string if needed to make it fit in a maximum length.""" |
no test coverage detected