.. _compare-to-empty-string:

compare-to-empty-string / C1901
===============================

**Message emitted:**

"%s" can be simplified to "%s" as an empty string is falsey

**Description:**

*Used when Pylint detects comparison to an empty string constant.*

**Problematic code:**

.. literalinclude:: /data/messages/c/compare-to-empty-string/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/c/compare-to-empty-string/good.py
   :language: python




.. note::
  This message is emitted by the optional :ref:`'compare-to-empty-string'<pylint.extensions.emptystring>`
   checker which requires the ``pylint.extensions.emptystring`` plugin to be loaded.

Created by the `compare-to-empty-string <https://github.com/PyCQA/pylint/blob/main/pylint/extensions/emptystring.py>`__ checker.