๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_string_formatting.asp
Python String Formatting
F-String was introduced in Python 3.6, and is now the preferred way of formatting strings.
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ tutorial โ€บ inputoutput.html
7. Input and Output โ€” Python 3.14.7 documentation
The % operator (modulo) can also be used for string formatting. Given format % values (where format is a string), % conversion specifications in format are replaced with zero or more elements of values. This operation is commonly known as string interpolation.
Discussions

Why should I use %d and %s to format Strings?
So from what I gather from the responses, it's good to know and recognise the %d and %s format, but in general nowadays people just use f-strings? More on reddit.com
๐ŸŒ r/learnpython
34
26
September 14, 2021
string - How to format a floating number to fixed width in Python - Stack Overflow
How do I format a floating number to a fixed width with the following requirements: Leading zero if n More on stackoverflow.com
๐ŸŒ stackoverflow.com
Using multiple arguments for string formatting in Python (e.g., '%s ... %s') - Stack Overflow
I have a string that looks like '%s in %s' and I want to know how to separate the arguments so that they are two different %s. My mind coming from Java came up with this: '%s in %s' % unicode(self.... More on stackoverflow.com
๐ŸŒ stackoverflow.com
is there any difference between using string.format() or an fstring?
Don't forget that f-strings haven't been around forever. It may be partly old habits, it may be not keeping up to date with features, they may still be wanting to target a minimum python version that didn't support f-strings. I'd tend to prefer to use f-strings, but I wouldn't crucify someone for using perfectly valid language constructs. More on reddit.com
๐ŸŒ r/Python
145
317
October 9, 2022
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ string.html
string โ€” Common string operations
It is exposed as a separate function for cases where you want to pass in a predefined dictionary of arguments, rather than unpacking and repacking the dictionary as individual arguments using the *args and **kwargs syntax. vformat() does the work of breaking up the format string into character data and replacement fields.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ string-formatting-in-python
String Formatting in Python - GeeksforGeeks
The format uses placeholder names formed by $ with valid Python identifiers (alphanumeric characters and underscores). Surrounding the placeholder with braces allows it to be followed by more alphanumeric letters with no intervening spaces.
Published: March 18, 2026
๐ŸŒ
PyFormat
pyformat.info
PyFormat: Using % and .format() for great good!
With new style formatting it is possible (and in Python 2.6 even mandatory) to give placeholders an explicit positional index.
๐ŸŒ
DEV Community
dev.to โ€บ erictleung โ€บ print-fixed-fields-using-f-strings-in-python-26ng
Print fixed fields using f-strings in Python - DEV Community
August 20, 2020 - Formatting strings in Python is very common. Older styles use a combination of % and .format() to for...
Find elsewhere
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ formatted-strings
Python Formatted Strings / f-string formatting Guide
Introduced in Python 3.6, f-strings use curly braces ({ and }) to embed Python expressions inside string literals. The most modern and recommended way to format strings in Python is by using f-strings (formatted string literals).
๐ŸŒ
Cornell Virtual Workshop
cvw.cac.cornell.edu โ€บ python-intro โ€บ input-output โ€บ string-formatting
Cornell Virtual Workshop > Introduction to Python Programming > Input/Output > String Formatting
One of the important methods in class str is str.format(). It applies formatting and variable substitution to a given string.. The string is filled in with the supplied set of arguments, according to format rules.
๐ŸŒ
Real Python
realpython.com โ€บ python-string-formatting
Python String Formatting: Available Tools and Their Features โ€“ Real Python
December 1, 2024 - In this tutorial, you'll learn about the main tools for string formatting in Python, as well as their strengths and weaknesses. These tools include f-strings, the .format() method, and the modulo operator.
๐ŸŒ
mkaz.blog
mkaz.blog โ€บ working-with-python โ€บ string-formatting
Python String Formatting: Complete Guide - mkaz.blog
The % formatting method is Pythonโ€™s oldest string formatting approach, but itโ€™s error-prone and less readable than modern alternatives.
๐ŸŒ
Python
peps.python.org โ€บ pep-3101
PEP 3101 โ€“ Advanced String Formatting | peps.python.org
This PEP proposes a new system for built-in string formatting operations, intended as a replacement for the existing โ€˜%โ€™ string formatting operator.
๐ŸŒ
OpenStax
openstax.org โ€บ books โ€บ introduction-python-programming โ€บ pages โ€บ 3-2-formatted-strings
3.2 Formatted strings - Introduction to Python Programming | OpenStax
March 13, 2024 - A formatted string literal (or f-string) is a string literal that is prefixed with "f" or "F". A replacement field is an expression in curly braces ({})...
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ what's better to use? (%), (f"string") or (.format())?
r/learnpython on Reddit: What's better to use? (%), (f"string") or (.format())?
November 25, 2024 -

I was trying to make a, silly program in which you can do some random things. I used arguments (%)in the past, but it's a bit hard to write like the identification of the variable, like there is so much types (%s, %f, %2f, %d, %g, %e...) and I want to take the easiest to write or the easiest to debug.

here are some examples of using each one:

  using (%):
name = "Imaginary_Morning"
age = 13
print("This profile is called %s and it has %d years old." % (name, age))
  
using (f"string"):
name = "Imaginary_Morning"
age = 13
print(f"This profile is called {name} and it has {age} years old.")

  using (.format()):
name = "Imaginary_Morning"
age = 13
print("This profile is called {} and it has {} years old.".format(name, age))
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_string_format.asp
Python String format() Method
Remove List Duplicates Reverse ... Python Interview Q&A Python Training ... The format() method formats the specified value(s) and insert them inside the string's placeholder....
๐ŸŒ
UC Berkeley Statistics
stat.berkeley.edu โ€บ ~spector โ€บ extension โ€บ python โ€บ notes โ€บ node42.html
Formatting Strings
Next: Using Names in Format Up: Input and Output Previous: The print command &nbsp Contents ยท In python, string formatting is performed through overloading of the percent operator (%) for string values. On the left hand side of the operator, you provide a string which is a combination of literal ...