Since python 3.6, the shortest and most performant way to format values into a string are PEP 498 f-strings (e.g. f'Hello {name}'
).
Converting older formatting types ('Hello %s' % name
, 'Hello {}'.format(name)
) to the new one in an existing code base appears to be a task that could be automated, however I could not find any tool doing this. Is there a tool to automatically convert literals using old string formatting to f-strings?