Do a series of global replacements on a string.
(text, *pairs)
| 261 | inspect.istraceback(object) or inspect.iscode(object)) |
| 262 | |
| 263 | def replace(text, *pairs): |
| 264 | """Do a series of global replacements on a string.""" |
| 265 | while pairs: |
| 266 | text = pairs[1].join(text.split(pairs[0])) |
| 267 | pairs = pairs[2:] |
| 268 | return text |
| 269 | |
| 270 | def cram(text, maxlen): |
| 271 | """Omit part of a string if needed to make it fit in a maximum length.""" |
no test coverage detected