Message147684
> So I guess this brings me back to my original issue. I'm not looking
> for particularly advanced stripping. I just want to remove all
> whitespace and other non-printing characters.
.strip only strips whitespace. Stripping non-printing characters and additional 'whitespace' is something that is too specific for a builtin method, especially because people might disagree on the characters that are considered whitespace and non-printing.
> Thus strip and isspace are now unusable methods in Python for common
> use cases. This seems unfortunate.
I believe they work fine for the common case -- in fact these methods have been around for years and no one complained.
Also Unicode has a number of more or less space-like characters that are not whitespace and whitespace chars that don't look like whitespace.
If one needs to strip a different set of (whitespace) chars, it's always possible to pass it to .strip or to define a new function like
def mystrip(s):
return s.strip().strip(u'\u200B\ufeff') |
|
Date |
User |
Action |
Args |
2011-11-15 15:24:26 | ezio.melotti | set | recipients:
+ ezio.melotti, loewis, rhettinger, mankyd |
2011-11-15 15:24:26 | ezio.melotti | set | messageid: <1321370666.08.0.718934922878.issue13391@psf.upfronthosting.co.za> |
2011-11-15 15:24:25 | ezio.melotti | link | issue13391 messages |
2011-11-15 15:24:24 | ezio.melotti | create | |
|