(direction, text, remove)
| 296 | |
| 297 | |
| 298 | def _strips(direction, text, remove): |
| 299 | if isinstance(remove, iters): |
| 300 | for subr in remove: |
| 301 | text = _strips(direction, text, subr) |
| 302 | return text |
| 303 | |
| 304 | if direction == "l": |
| 305 | if text.startswith(remove): |
| 306 | return text[len(remove) :] |
| 307 | elif direction == "r": |
| 308 | if text.endswith(remove): |
| 309 | return text[: -len(remove)] |
| 310 | else: |
| 311 | raise ValueError("Direction needs to be r or l.") |
| 312 | return text |
| 313 | |
| 314 | |
| 315 | def rstrips(text, remove): |