bad-str-strip-call (PLE1310)#
Derived from the Pylint linter.
What it does#
Checks duplicate characters in str.strip
calls.
Why is this bad?#
All characters in str.strip
calls are removed from both the leading and
trailing ends of the string. Including duplicate characters in the call
is redundant and often indicative of a mistake.
In Python 3.9 and later, you can use str.removeprefix
and
str.removesuffix
to remove an exact prefix or suffix from a string,
respectively, which should be preferred when possible.
Example#
Use instead:
Or: