.. _consider-using-f-string: consider-using-f-string / C0209 =============================== **Message emitted:** ``Formatting a regular string which could be an f-string`` **Description:** *Used when we detect a string that is being formatted with format() or % which could potentially be an f-string. The use of f-strings is preferred. Requires Python 3.6 and ``py-version >= 3.6``.* **Problematic code:** .. literalinclude:: /data/messages/c/consider-using-f-string/bad.py :language: python **Correct code:** .. literalinclude:: /data/messages/c/consider-using-f-string/good.py :language: python **Additional details:** Formatted string literals (f-strings) give a concise, consistent syntax that can replace most use cases for the ``%`` formatting operator, ``str.format()`` and ``string.Template``. F-strings also perform better than alternatives; see `this tweet `_ for a simple example. Created by the `refactoring `__ checker.