.. _bad-str-strip-call:

bad-str-strip-call / E1310
==========================

**Message emitted:**

Suspicious argument in %s.%s call

**Description:**

*The argument to a str.{l,r,}strip call contains a duplicate character,*

**Problematic code:**

.. literalinclude:: /data/messages/b/bad-str-strip-call/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/b/bad-str-strip-call/good.py
   :language: python

**Additional details:**

A common misconception is that ``str.strip('Hello')`` removes the *substring* ``'Hello'`` from the beginning and end of the string.
This is **not**  the case.
From the `documentation <https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.strip>`_:

> The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped

Duplicated characters in the ``str.strip`` call, besides not having any effect on the actual result, may indicate this misunderstanding.

**Related links:**

- Documentation: `str.strip([chars]) <https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.strip>`_

Created by the `string <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/strings.py>`__ checker.