.. _bad-open-mode:

bad-open-mode / W1501
=====================

**Message emitted:**

"%s" is not a valid mode for open.

**Description:**

*Python supports: r, w, a[, x] modes with b, +, and U (only with r) options. See https://docs.python.org/3/library/functions.html#open*

**Problematic code:**

.. literalinclude:: /data/messages/b/bad-open-mode/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/b/bad-open-mode/good.py
   :language: python



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