Here's what I have as a reference. Basically a summary of the Format Specification Mini-Language . This would all go after a : in the f-string curly braces. So if you want a float with 2 decimal place precision, with * as fill and right aligned in a field width of 10 characters you'd do f"{val:*>10.2f}" [[fill]align][sign][#][0][minimumwidth][.precision][type] Fill: Add a character to fill with. Must be followed by Align flag. Align: '<' - Forces the field to be left-aligned within the available space (This is the default.) '>' - Forces the field to be right-aligned within the available space. '=' - Forces the padding to be placed after the sign (if any) but before the digits. This is used for printing fields in the form '+000000120'. This alignment option is only valid for numeric types. '^' - Forces the field to be centered within the available space. Sign: '+' - indicates that a sign should be used for both positive as well as negative numbers '-' - indicates that a sign should be used only for negative numbers (this is the default behavior) ' ' - indicates that a leading space should be used on positive numbers #: Flags alternate numbering formats; binary, octal, and hexadecimal output will be prefixed with '0b', '0o', and '0x', respectively. 0: Zero-padding. Equivalent to fill '=' and character of '0' Minimumwidth: Min width of the field. Precision: Decimal places for floats or max field size for non-numeric types. Type: Integers: 'b' - Binary. Outputs the number in base 2. 'c' - Character. Converts the integer to the corresponding Unicode character before printing. 'd' - Decimal Integer. Outputs the number in base 10. 'o' - Octal format. Outputs the number in base 8. 'x' - Hex format. Outputs the number in base 16, using lower- case letters for the digits above 9. 'X' - Hex format. Outputs the number in base 16, using upper- case letters for the digits above 9. 'n' - Number. This is the same as 'd', except that it uses the current locale setting to insert the appropriate number separator characters. '' (None) - the same as 'd' Floats: 'e' - Exponent notation. Prints the number in scientific notation using the letter 'e' to indicate the exponent. 'E' - Exponent notation. Same as 'e' except it converts the number to uppercase. 'f' - Fixed point. Displays the number as a fixed-point number. 'F' - Fixed point. Same as 'f' except it converts the number to uppercase. 'g' - General format. This prints the number as a fixed-point number, unless the number is too large, in which case it switches to 'e' exponent notation. 'G' - General format. Same as 'g' except switches to 'E' if the number gets to large. 'n' - Number. This is the same as 'g', except that it uses the current locale setting to insert the appropriate number separator characters. '%' - Percentage. Multiplies the number by 100 and displays in fixed ('f') format, followed by a percent sign. '' (None) - similar to 'g', except that it prints at least one digit after the decimal point. Answer from ebdbbb on reddit.com
🌐
Python Morsels
pythonmorsels.com › string-formatting
Python f-string tips & cheat sheets - Python Morsels
April 12, 2022 - >>> name = "Trey" >>> print(f"My name is {name}. What's your name?") My name is Trey. What's your name? ... But Python's string formatting syntax also allows us to control the formatting of each of these string components. There is a lot of complexity in Python's string formatting syntax. If you're just here for quick answers, skip to the cheat sheets section.
🌐
Fstring
fstring.help › cheat
Python f-string cheat sheet
Type f with precision .n displays n digits after the decimal point. Type g with precision .n displays n significant digits in scientific notation. Trailing zeros are not displayed. ... An empty type is synonymous with d for integers. These format specifications only work on integers (int).
🌐
DEV Community
dev.to › amohgodwin › f-strings-the-ultimate-cheatsheet-for-python-string-formatting-3cn
F-Strings: The Ultimate Cheatsheet for Python String Formatting - DEV Community
July 13, 2025 - First, let's briefly look at the older methods f-strings improve upon. ... folder = "/home/user/john/movies" filename = "Big Buck Bunny.mp4" print("The folder name is '" + folder + "' and the filename is '" + filename + "'.") ... All these methods work, but they can be verbose and hard to read, especially with multiple variables. Now, let's see how f-strings can simplify the previous examples.
🌐
Cheatography
cheatography.com › brianallan › cheat-sheets › python-f-strings-basics
Python F-Strings Basics Cheat Sheet by BrianAllan - Download free from Cheatography - Cheatography.com: Cheat Sheets For Every Occasion
March 16, 2022 - Contains formulas, tables, and examples showing patterns and options, with the exception of number formatting, for Python's Formatted String Literals -- i.e., F-Strings. ... https://cheatography.com/brianallan/cheat-sheets/python-f-strings-basics/ //media.cheatography.com/storage/thumb/brianallan_python-f-strings-basics.750.jpg
Rating: 0 ​ - ​ 1 votes
🌐
Cheatography
cheatography.com › brianallan › cheat-sheets › python-f-strings-number-formatting
Python F-Strings Number Formatting Cheat Sheet by BrianAllan - Download free from Cheatography - Cheatography.com: Cheat Sheets For Every Occasion
Contains formulas, tables, and examples showing patterns and options focused on number formatting for Python's Formatted String Literals -- i.e., F-Strings.
Rating: 0 ​ - ​ 2 votes
Top answer
1 of 2
3
Here's what I have as a reference. Basically a summary of the Format Specification Mini-Language . This would all go after a : in the f-string curly braces. So if you want a float with 2 decimal place precision, with * as fill and right aligned in a field width of 10 characters you'd do f"{val:*>10.2f}" [[fill]align][sign][#][0][minimumwidth][.precision][type] Fill: Add a character to fill with. Must be followed by Align flag. Align: '<' - Forces the field to be left-aligned within the available space (This is the default.) '>' - Forces the field to be right-aligned within the available space. '=' - Forces the padding to be placed after the sign (if any) but before the digits. This is used for printing fields in the form '+000000120'. This alignment option is only valid for numeric types. '^' - Forces the field to be centered within the available space. Sign: '+' - indicates that a sign should be used for both positive as well as negative numbers '-' - indicates that a sign should be used only for negative numbers (this is the default behavior) ' ' - indicates that a leading space should be used on positive numbers #: Flags alternate numbering formats; binary, octal, and hexadecimal output will be prefixed with '0b', '0o', and '0x', respectively. 0: Zero-padding. Equivalent to fill '=' and character of '0' Minimumwidth: Min width of the field. Precision: Decimal places for floats or max field size for non-numeric types. Type: Integers: 'b' - Binary. Outputs the number in base 2. 'c' - Character. Converts the integer to the corresponding Unicode character before printing. 'd' - Decimal Integer. Outputs the number in base 10. 'o' - Octal format. Outputs the number in base 8. 'x' - Hex format. Outputs the number in base 16, using lower- case letters for the digits above 9. 'X' - Hex format. Outputs the number in base 16, using upper- case letters for the digits above 9. 'n' - Number. This is the same as 'd', except that it uses the current locale setting to insert the appropriate number separator characters. '' (None) - the same as 'd' Floats: 'e' - Exponent notation. Prints the number in scientific notation using the letter 'e' to indicate the exponent. 'E' - Exponent notation. Same as 'e' except it converts the number to uppercase. 'f' - Fixed point. Displays the number as a fixed-point number. 'F' - Fixed point. Same as 'f' except it converts the number to uppercase. 'g' - General format. This prints the number as a fixed-point number, unless the number is too large, in which case it switches to 'e' exponent notation. 'G' - General format. Same as 'g' except switches to 'E' if the number gets to large. 'n' - Number. This is the same as 'g', except that it uses the current locale setting to insert the appropriate number separator characters. '%' - Percentage. Multiplies the number by 100 and displays in fixed ('f') format, followed by a percent sign. '' (None) - similar to 'g', except that it prints at least one digit after the decimal point.
2 of 2
1
A cheat sheet for f-string would be too short and kind of useless since f-string are super simple. If you want to put a number just do it. Ex. name: str = "Albus Dumbledore" age: int = 116 print(f"Name: {name}, Age: {age}") As you can see, I simply put age (which is an int) inside 2 brackets in the string (don't forget the f) and let Python do it's magic. (If you want you can use the example above as your cheat sheet)
🌐
SyntaxCache
syntaxcache.com › home › cheat sheets › python › python f-strings cheat sheet
Python f-strings Cheat Sheet | SyntaxCache
February 22, 2026 - Python f-string cheat sheet — format specs, padding, date formatting, and debug mode at a glance. Copy-paste snippets with output comments.
Find elsewhere
🌐
Python Cheat Sheet
pythoncheatsheet.org › home › string formatting
Python String Formatting - Python Cheat Sheet
# str.format() method: modern string formatting (Python 2.7+) name = 'John' age = 20 "Hello I'm {}, my age is {}".format(name, age) # {} = placeholder ... If your are using Python 3.6+, string f-Strings are the recommended way to format strings.
🌐
Android Experto
androidexperto.com › home › f-strings: the ultimate cheatsheet for python string formatting
F-Strings: The Ultimate Cheatsheet for Python String Formatt
May 25, 2026 - Python f-strings make string formatting fast, readable, and concise. Introduced in Python 3.6, they let you place variables, expressions, and formatting rules directly inside string literals, avoiding the clutter of older approaches like % formatting or .format(). This cheatsheet covers the ...
🌐
Cheatography
cheatography.com › brianallan › cheat-sheets › python-f-strings-basics › pdf pdf
Python F-Strings Basics Cheat Sheet by BrianAllan
Python F-Strings Basics Cheat Sheet ... used by f-string must have different kind of quotes · f'She has {pet['​cat​s']}.'  · Format​ting: Fill, Align, Width ·...
🌐
Myshell
myshell.co.uk › blog › 2018 › 11 › python-f-string-formatting-cheatsheet
Python: f-string formatting cheatsheet :: myshell.co.uk
November 5, 2018 - Note: All examples below were executed in Python interactive shell (REPL - Read, Eval, Print and Loop). [[fill]align][sign][#][0][width][grouping_option][.precision][type]
🌐
Pybites
pybit.es › articles › python-f-string-codes-i-use-every-day
Python F-String Codes I Use Every Day – Pybites
April 5, 2024 - Therefore, the default format would look like below. ... f-string obviously creates a string (try this code to confirm it: type(f”now:%Y-%m-%d %H:%M%S.%f}”)). Therefore, if e.g.
🌐
Alexanderjunge
alexanderjunge.net › blog › til-fstring-formatting
Alexander Junge's website - TIL: f-string formatting - a cheat sheet
I am a big fan of f-strings in Python. If you are not using them yet, you should! f-strings come with a string formatting syntax that makes it very convenient to create nicely formatted strings. For example, you can introduce padding: ... The trouble is that I ALWAYS forget this syntax and need to search online every single time without good hits. BUT: this is now solved thanks to this awesome cheatsheet I discovered today: https://fstring.help/cheat/ 🤩
🌐
TechBloat
techbloat.com › home › f-strings: the ultimate cheatsheet for python string formatting
F-Strings: The Ultimate Cheatsheet for Python String Formatt
May 24, 2026 - Introduced in Python 3.6, they ... covers the patterns you’ll use most often: inserting values, formatting numbers and dates, controlling alignment and padding, escaping braces and quotes, and using handy debugging syntax....
🌐
Alexwlchan
alexwlchan.net › notes › 2026 › f-strings-cheatsheet
Python f-strings cheat sheet – alexwlchan
This is a collection of Python f-string (“formatted string”) examples that I find helpful but don’t always remember.
🌐
Plain English
python.plainenglish.io › mastering-100-python-f-strings-from-basic-to-advanced-novel-tricks-and-cheat-sheets-43a582104f21
Mastering 100 Python F-Strings from Basic to Advanced, Novel Tricks and Cheat Sheets
February 13, 2024 - Call functions directly within the F-string braces for dynamic string formatting. def greet(name): return f"Hello, {name}!" print(f"{greet('Bob')}") Use format specifiers for controlling the format of the output, such as number of decimals.
🌐
Hacker News
news.ycombinator.com › item
Python f-string cheat sheets (2022) | Hacker News
August 22, 2025 - I'm also the author of https://fstring.help/cheat/ (though not of the homepage) and I haven't yet linked back to that new tool. I was surprised to the cheat sheet here today but not the format guesser · At the very least, your tool wasn't able to figure it out and hardcoded most of the number ...
🌐
Reddit
reddit.com › r/python › python f-strings number formatting cheat sheet
r/Python on Reddit: Python F-Strings Number Formatting Cheat Sheet
August 12, 2022 - T-Strings: Python's Fifth String Formatting Technique? ... Made a Python Cheat Sheet for Data Structures and Algorithms (useful for Leetcode).
🌐
OpenPython
openpython.org › home › articles › python f-strings and string formatting: the complete guide
Python f-strings and String Formatting: The Complete Guide | OpenPython
3 weeks ago - Use conversion flags !s, !r, and ... with strftime codes, and let formatting parameters themselves be variables: f"{value:{width}.{precision}f}"....