Skip to content

Commit

Permalink
Update strip.md
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelCurrin authored Jan 20, 2025
1 parent d9ffa54 commit 7261751
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cheatsheets/python/strings/strip.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,21 @@ Here, we specify `#`, `$`, and `c` will get removed.
'%ab'
```


## Remove common leading whitespace from multiline string

```python
from textwrap import dedent

result = dedent("""
ABC
DEF
XYZ
"""))
# '\nABC\n DEF\nXYZ\n'

print(result)
# ABC
# DEF
# XYZ
```

0 comments on commit 7261751

Please sign in to comment.