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
Importer
Importer - Obsidian Help
Templates
Templates - Obsidian Help
Callouts
Callouts - Obsidian Help
Basic formatting syntax
Basic formatting syntax - Obsidian Help
🌐
Visual Studio Code
code.visualstudio.com › docs › datascience › jupyter-notebooks
Jupyter Notebooks in VS Code
November 3, 2021 - You can export a Jupyter Notebook as a Python file (.py), a PDF, or an HTML file. To export, select ... > Export on the main toolbar. You're then presented with a dropdown of file format options.
People also ask

What will I learn in this course?
This course consists of four modules.  Module 1 - Python Basics  oYour first program  oTypes  oExpressions and Variables  oString Operations    Module 2 - Python Data Structures  oLists and Tuples  oSets  oDictionaries    Module 3 - Python Programming Fundamentals  oConditions and Branching  oLoops  oFunctions  oObjects and Classes    Module 4 - Working with Data in Python  oReading files with open  oWriting files with open  oLoading data with Pandas  oNumpy     Finally, you will create a project to test your skills.
🌐
coursera.org
coursera.org › browse › data science › data analysis
Python for Data Science, AI & Development | Coursera
When will I have access to the lectures and assignments?
To access the course materials, assignments and to earn a Certificate, you will need to purchase the Certificate experience when you enroll in a course. You can try a Free Trial instead, or apply for Financial Aid. The course may offer 'Full Course, No Certificate' instead. This option lets you see all course materials, submit required assessments, and get a final grade. This also means that you will not be able to purchase a Certificate experience.
🌐
coursera.org
coursera.org › browse › data science › data analysis
Python for Data Science, AI & Development | Coursera
What will I get if I subscribe to this Certificate?
When you enroll in the course, you get access to all of the courses in the Certificate, and you earn a certificate when you complete the work. Your electronic Certificate will be added to your Accomplishments page - from there, you can print your Certificate or add it to your LinkedIn profile.
🌐
coursera.org
coursera.org › browse › data science › data analysis
Python for Data Science, AI & Development | Coursera
🌐
Note.nkmk.me
note.nkmk.me › home › python
How to Use f-strings in Python | note.nkmk.me
May 18, 2023 - If you place a space before or after the variable name and =, it will be preserved in the output. print(f'{i = }') # i = 123 print(f'{ i = }') # i = 123 ... You can also specify format specification strings and expressions with the = specifier.
🌐
Cheatography
cheatography.com › eazykaye › cheat-sheets › python3-f-strings
Python3 F-Strings Cheat Sheet by eazykaye - Download free from Cheatography - Cheatography.com: Cheat Sheets For Every Occasion
https://cheatography.com/eazykaye/cheat-sheets/python3-f-strings/ //media.cheatography.com/storage/thumb/eazykaye_python3-f-strings.750.jpg ... Your Download Will Begin Automatically in 12 Seconds. ... No comments yet. Add yours below! ... Contains formulas, tables, and examples showing patterns and options focused on number formatting for Python's Formatted String Literals -- i.e., F-Strings.
🌐
Shopify
shopify.dev › docs › api › liquid
Liquid reference
My custom string. Liquid Cheat Sheet · A simple reference guide to the Liquid language. Liquid Cheat Sheet · A simple reference guide to the Liquid language. Liquid Cheat Sheet · A simple reference guide to the Liquid language. Theme Check · Command line-based linter for themes.
🌐
Coursera
coursera.org › browse › data science › data analysis
Python for Data Science, AI & Development | Coursera
October 20, 2022 - Hands-on Lab: Write Your First Program• 10 minutes · Hands-on Lab: Types• 10 minutes · Hands-on Lab: Expression and Variables• 10 minutes · Hands-On Lab: String Operations• 30 minutes · (Optional) Reading: Format Strings in Python• 5 minutes · Cheat Sheet: Python Basics • 15 minutes ·
Rating: 4.6 ​ - ​ 43.4K votes
Find elsewhere
🌐
DZone
dzone.com › coding › languages › efficient string formatting with python f-strings
Efficient String Formatting With Python f-Strings
January 2, 2024 - In the example above, .2f specifies that the floating-point number should be formatted with two decimal places. We can use the ternary operator inside the f-strings for evaluating conditional expressions.
🌐
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).
🌐
Python Morsels
pythonmorsels.com › string-formatting
Python f-string tips & cheat sheets - Python Morsels
April 12, 2022 - You can use the below tables as cheat sheets to help you during your string formatting adventures. Or use the fstring.help/cheat to quickly find these reference tables.
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)
🌐
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
March 16, 2022 - 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
🌐
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.
🌐
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 ...
🌐
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.
🌐
Real Python
realpython.com › python-f-strings
Python's F-String for String Interpolation and Formatting – Real Python
November 30, 2024 - Python 3.12 improved f-strings by allowing nested expressions and the use of backslashes. This tutorial will guide you through the features and advantages of f-strings, including interpolation and formatting.
🌐
Myshell
myshell.co.uk › blog › 2018 › 11 › python-f-string-formatting-cheatsheet
Python: f-string formatting cheatsheet
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]
🌐
Python Cheatsheet
pythoncheatsheet.org › home › string formatting
Python String Formatting - Python Cheatsheet
# 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.
🌐
Tech
abc-notes.data.tech.gov.sg › notes › topic-1-llm-&-prompt-engineering › 7.-extra-f-strings-formatting-cheat-sheet.html
7. Extra - F-strings formatting Cheat Sheet
Title: Extra - F-strings formatting Cheat Sheet · 1. Expressions Inside Braces · 2. Calling Functions · 3. Format Specifiers · 4. Dictionary Values · 5. Date Formatting · 6. Multiline F-strings · 7. Conditional Expressions · 8. Nesting F-strings · 9. Using Braces · 10. Debugging with F-strings (Python 3.8+) 11.
🌐
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
🌐
LearnPython.com
learnpython.com › blog › python-string-formatting
Python’s String format() Cheat Sheet | LearnPython.com
May 30, 2022 - Everything you need to know about formatting strings in Python and the Python formatting mini-language. You may know all kinds of ways to manually manipulate strings in Python – maybe you learned from our Working with Strings in Python course (part of the Python Basics track).