3 ms·
in the same theme, NTLAIL strip(), rstrip(), lstrip() can strip other kinds of characters besides whitespace.
by zzzeek 1y ago
in the same theme, NTLAIL strip(), rstrip(), lstrip() can strip other kinds of characters besides whitespace.
- masklinn 1y agoOne thing to note tho is that they take character sets, as long as they encounter characters in the specified set they will keep stripping. Lots of people think if you give it a string it will remove that string. That feature was added in 3.9 with the addition of `removeprefix` and `removesuffix`. Sadly, 1. unlike Rust's version they provide no way of knowing whether they stripped things out 2. unlike startswith/endswith they do not take tuples of prefixes/suffixes