← All recipes
Moderne licensed

Replace str.format() with f-string

Recipe IDorg.openrewrite.python.migrate.ReplaceStrFormatWithFStringArtifactopenrewrite-migrate-python

Replace "...".format(...) calls with f-strings (Python 3.6+). Only converts cases where the format string is a literal and the conversion is safe.

Single recipepythonmigration3.6f-stringProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.python.migrate.ReplaceStrFormatWithFString

If the recipe isn’t available locally, install it with:

mod config recipes pip install openrewrite-migrate-python