René's URL Explorer Experiment


Title: Python's F-String for String Interpolation and Formatting – Real Python

Open Graph Title: Python's F-String for String Interpolation and Formatting – Real Python

Description: Python f-strings give you a readable, concise way to interpolate and format strings, and they beat .format() and the % operator on speed.

Open Graph Description: Python f-strings give you a readable, concise way to interpolate and format strings, and they beat .format() and the % operator on speed.

Mail addresses
?subject=Python article for you&body=Python's F-String for String Interpolation and Formatting on Real Python https://realpython.com/python-f-strings/

Opengraph URL: https://realpython.com/python-f-strings/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
{
  "@context": "http://schema.org",
  "@type": "Article",
  "headline": "Python's F-String for String Interpolation and Formatting",
  "image": {
    "@type": "ImageObject",
    "url": "https://files.realpython.com/media/UPDATE-f-strings_Watermarked.4d90960e7897.jpg",
    "width": 1920,
    "height": 1080
  },
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://realpython.com/python-f-strings/",
    "lastReviewed": "2026-10-23",
    "author": {
      "@type": "Person",
      "name": "Joanna Jablonski",
      "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/jjablonksi-avatar.e37c4f83308e.jpg",
      "url": "https://realpython.com/team/jjablonski/",
      "affiliation": {
        "@type": "Organization",
        "@id": "https://realpython.com/#organization",
        "name": "Real Python",
        "url": "https://realpython.com",
        "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
      }
    },
    "reviewedBy": [
      {
        "@type": "Person",
        "name": "Adriana Cutenco",
        "image": "https://realpython.com/cdn-cgi/image/width=900,height=900,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/acutenco.676e4197c133.jpg",
        "url": "https://realpython.com/team/acutenco/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Aldren Santos",
        "image": "https://realpython.com/cdn-cgi/image/width=500,height=500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Aldren_Santos_Real_Python.6b0861d8b841.png",
        "url": "https://realpython.com/team/asantos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Brenda Weleschuk",
        "image": "https://realpython.com/cdn-cgi/image/width=320,height=320,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/IMG_3324_1.50b309355fc1.jpg",
        "url": "https://realpython.com/team/bweleschuk/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Bartosz Zaczy\u0144ski",
        "image": "https://realpython.com/cdn-cgi/image/width=1694,height=1694,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/coders_lab_2109368.259b1599fbee.jpg",
        "url": "https://realpython.com/team/bzaczynski/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "David Amos",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/me-small.f5f49f1c48e1.jpg",
        "url": "https://realpython.com/team/damos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Dan Bader",
        "image": "https://realpython.com/cdn-cgi/image/width=1000,height=1000,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/daniel-square.d58bf4388750.jpg",
        "url": "https://realpython.com/team/dbader/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Geir Arne Hjelle",
        "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/gahjelle.470149ee709e.jpg",
        "url": "https://realpython.com/team/gahjelle/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Jim Anderson",
        "image": "https://realpython.com/cdn-cgi/image/width=700,height=700,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/jima.0b8f990b951a.jpg",
        "url": "https://realpython.com/team/janderson/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Kate Finegan",
        "image": "https://realpython.com/cdn-cgi/image/width=400,height=400,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/VZxEtUor_400x400.7169c68e3950.jpg",
        "url": "https://realpython.com/team/kfinegan/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Leodanis Pozo Ramos",
        "image": "https://realpython.com/cdn-cgi/image/width=862,height=862,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/Perfil_final1.9f896bc212f6.jpg",
        "url": "https://realpython.com/team/lpozoramos/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Martin Breuss",
        "image": "https://realpython.com/cdn-cgi/image/width=456,height=456,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/martin_breuss_python_square.efb2b07faf9f.jpg",
        "url": "https://realpython.com/team/mbreuss/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      },
      {
        "@type": "Person",
        "name": "Pavel Anni",
        "image": "https://realpython.com/cdn-cgi/image/width=1500,height=1500,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/real-python-logo-square.28474fda9228.png",
        "url": "https://realpython.com/team/panni/",
        "affiliation": {
          "@type": "Organization",
          "@id": "https://realpython.com/#organization",
          "name": "Real Python",
          "url": "https://realpython.com",
          "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
        }
      }
    ]
  },
  "datePublished": "2026-10-23T14:00:00+00:00",
  "dateModified": "2026-10-23T14:09:48.393000+00:00",
  "publisher": {
    "@type": "Organization",
    "@id": "https://realpython.com/#organization",
    "name": "Real Python",
    "url": "https://realpython.com",
    "logo": {
      "@type": "ImageObject",
      "url": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png",
      "width": 512,
      "height": 512
    },
    "description": "Real Python is a leading provider of online Python education and one of the largest language-specific online communities for software developers. It publishes high-quality learning resources, such as tutorials, books, and courses to an audience of millions of developers, data scientists, and machine learning engineers each month.",
    "slogan": "Become a Python Expert",
    "email": "info@realpython.com",
    "sameAs": [
      "https://github.com/realpython",
      "https://www.youtube.com/realpython",
      "https://twitter.com/realpython",
      "https://x.com/realpython",
      "https://www.linkedin.com/company/realpython-com/",
      "https://www.facebook.com/learnrealpython",
      "https://www.instagram.com/realpython",
      "https://www.tiktok.com/@realpython.com"
    ]
  },
  "author": {
    "@type": "Person",
    "name": "Joanna Jablonski",
    "image": "https://realpython.com/cdn-cgi/image/width=800,height=800,fit=crop,gravity=auto,format=auto/https://files.realpython.com/media/jjablonksi-avatar.e37c4f83308e.jpg",
    "url": "https://realpython.com/team/jjablonski/",
    "affiliation": {
      "@type": "Organization",
      "@id": "https://realpython.com/#organization",
      "name": "Real Python",
      "url": "https://realpython.com",
      "logo": "https://realpython.com/static/real-python-logo-square-512.157ae6bf64ed.png"
    }
  },
  "description": "Python f-strings give you a readable, concise way to interpolate and format strings, and they beat .format() and the % operator on speed.",
  "hasPart": {
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "What is an f-string in Python?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "\u003cp\u003eAn f-string, or formatted string literal, is a way to include expressions inside string literals using curly braces \u003ccode\u003e{}\u003c/code\u003e. Introduced in Python 3.6, f-strings allow for more readable and concise string formatting and interpolation, and provide a more efficient alternative to older methods like the modulo (\u003ccode\u003e%\u003c/code\u003e) operator and \u003ccode\u003e.format()\u003c/code\u003e method.\u003c/p\u003e"
        }
      },
      {
        "@type": "Question",
        "name": "How do you write an f-string in Python?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "\u003cp\u003eTo write an f-string in Python, you need to add an \u003ccode\u003ef\u003c/code\u003e or \u003ccode\u003eF\u003c/code\u003e prefix before the string literal. Inside this string literal, you can include variables, objects, and expressions in curly braces.\u003c/p\u003e"
        }
      },
      {
        "@type": "Question",
        "name": "How do you format numbers in f-strings?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "\u003cp\u003eYou can format numbers in f-strings by using format specifiers inside the curly braces. For example, you can use \u003ccode\u003e:.2f\u003c/code\u003e to format a floating-point number with two decimal places.\u003c/p\u003e"
        }
      },
      {
        "@type": "Question",
        "name": "Can you embed expressions in f-strings?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "\u003cp\u003eYes, you can embed almost any Python expression in f-strings, including calculations, list comprehensions, and method calls.\u003c/p\u003e"
        }
      },
      {
        "@type": "Question",
        "name": "What are the advantages of f-strings compared to traditional tools?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "\u003cp\u003eF-strings provide a few advantages over the \u003ccode\u003e%\u003c/code\u003e operator and the \u003ccode\u003e.format()\u003c/code\u003e method. They are more readable and concise because you can directly embed variables and expressions within the string. They are also faster and more efficient in programs that deal with a large number of strings.\u003c/p\u003e"
        }
      },
      {
        "@type": "Question",
        "name": "What limitations did f-strings have before Python 3.12?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "\u003cp\u003eBefore Python 3.12, f-strings had several limitations: they didn\u0026rsquo;t support the use of backslashes in embedded expressions, the reuse of the same type of quotation marks for nested f-strings, or comments within expressions. These limitations were addressed in Python 3.12, enabling more flexible and complex expressions.\u003c/p\u003e"
        }
      },
      {
        "@type": "Question",
        "name": "When should you avoid using f-strings?",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "\u003cp\u003eYou should avoid using f-strings when you need \u003ca href=\"/ref/computer-science-glossary/lazy-evaluation/\" class=\"ref-link\"\u003elazy evaluation\u003c/a\u003e, such as in logging, where the string should only be constructed if the log level warrants it. Additionally, avoid using them in SQL queries to prevent SQL injection risks. For internationalization and localization tasks, it\u0026rsquo;s better to use the \u003ccode\u003e.format()\u003c/code\u003e method.\u003c/p\u003e"
        }
      }
    ]
  }
}

authorReal Python
theme-color#18354c
color-schemelight dark
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/UPDATE-f-strings_Watermarked.4d90960e7897.jpg
og:imagehttps://files.realpython.com/media/UPDATE-f-strings_Watermarked.4d90960e7897.jpg
twitter:creator@realpython
og:typearticle
og:site_nameReal Python
apple-mobile-web-app-titleReal Python

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/python-f-strings
Your Learning Plan →Your personalized Python learning planhttps://realpython.com/account/learning-plan/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest&_from=nav_library
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/search?kind=exercise&kind=quiz&_from=nav_library
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Mentor AI →NewYour personal Python mentorhttps://realpython.com/mentor/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Live Courses →Live, instructor-led Python courseshttps://realpython.com/live/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Unlock All Content and Become a Python Expert →Get unlimited access to all Real Python has to offerhttps://realpython.com/account/join/?from=navbar_learn
Unlock All Content →Become a Python Experthttps://realpython.com/account/join/?from=navbar_learn
More https://realpython.com/python-f-strings
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Contributorhttps://realpython.com/jobs/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?intent=navbar&next=%2Fpython-f-strings%2F
🎁 Black Friday Giveaway: Enter for a chance to win prizes worth over $1,090 »https://realpython.com/blackfriday
Browse Topicshttps://realpython.com/tutorials/all/
Guided Learning Pathshttps://realpython.com/learning-paths/
Basicshttps://realpython.com/search?level=basics&_from=sidebar_level
Intermediatehttps://realpython.com/search?level=intermediate&_from=sidebar_level
Advancedhttps://realpython.com/search?level=advanced&_from=sidebar_level
aihttps://realpython.com/tutorials/ai/
algorithmshttps://realpython.com/tutorials/algorithms/
apihttps://realpython.com/tutorials/api/
best-practiceshttps://realpython.com/tutorials/best-practices/
careerhttps://realpython.com/tutorials/career/
communityhttps://realpython.com/tutorials/community/
databaseshttps://realpython.com/tutorials/databases/
data-sciencehttps://realpython.com/tutorials/data-science/
data-structureshttps://realpython.com/tutorials/data-structures/
data-vizhttps://realpython.com/tutorials/data-viz/
devopshttps://realpython.com/tutorials/devops/
djangohttps://realpython.com/tutorials/django/
dockerhttps://realpython.com/tutorials/docker/
editorshttps://realpython.com/tutorials/editors/
flaskhttps://realpython.com/tutorials/flask/
front-endhttps://realpython.com/tutorials/front-end/
gamedevhttps://realpython.com/tutorials/gamedev/
guihttps://realpython.com/tutorials/gui/
machine-learninghttps://realpython.com/tutorials/machine-learning/
newshttps://realpython.com/tutorials/news/
numpyhttps://realpython.com/tutorials/numpy/
projectshttps://realpython.com/tutorials/projects/
pythonhttps://realpython.com/tutorials/python/
stdlibhttps://realpython.com/tutorials/stdlib/
testinghttps://realpython.com/tutorials/testing/
toolshttps://realpython.com/tutorials/tools/
web-devhttps://realpython.com/tutorials/web-dev/
web-scrapinghttps://realpython.com/tutorials/web-scraping/
Table of Contentshttps://realpython.com/python-f-strings#toc
Interpolating and Formatting Strings Before Python 3.6https://realpython.com/python-f-strings#interpolating-and-formatting-strings-before-python-36
The Modulo Operator (%)https://realpython.com/python-f-strings#the-modulo-operator
The str.format() Methodhttps://realpython.com/python-f-strings#the-strformat-method
Doing String Interpolation With F-Strings in Pythonhttps://realpython.com/python-f-strings#doing-string-interpolation-with-f-strings-in-python
Interpolating Values and Objects in F-Stringshttps://realpython.com/python-f-strings#interpolating-values-and-objects-in-f-strings
Embedding Expressions in F-Stringshttps://realpython.com/python-f-strings#embedding-expressions-in-f-strings
Formatting Strings With Python’s F-Stringhttps://realpython.com/python-f-strings#formatting-strings-with-pythons-f-string
Other Relevant Features of F-Stringshttps://realpython.com/python-f-strings#other-relevant-features-of-f-strings
Using an Object’s String Representations in F-Stringshttps://realpython.com/python-f-strings#using-an-objects-string-representations-in-f-strings
Self-Documenting Expressions for Debugginghttps://realpython.com/python-f-strings#self-documenting-expressions-for-debugging
Comparing Performance: F-String vs Traditional Toolshttps://realpython.com/python-f-strings#comparing-performance-f-string-vs-traditional-tools
Upgrading F-Strings: Python 3.12 and Beyondhttps://realpython.com/python-f-strings#upgrading-f-strings-python-312-and-beyond
Using Quotation Markshttps://realpython.com/python-f-strings#using-quotation-marks
Using Backslasheshttps://realpython.com/python-f-strings#using-backslashes
Writing Inline Commentshttps://realpython.com/python-f-strings#writing-inline-comments
Deciphering F-String Error Messageshttps://realpython.com/python-f-strings#deciphering-f-string-error-messages
Using Traditional String Formatting Tools Over F-Stringshttps://realpython.com/python-f-strings#using-traditional-string-formatting-tools-over-f-strings
Dictionary Interpolationhttps://realpython.com/python-f-strings#dictionary-interpolation
Lazy Evaluation in Logginghttps://realpython.com/python-f-strings#lazy-evaluation-in-logging
SQL Database Querieshttps://realpython.com/python-f-strings#sql-database-queries
Internationalization and Localizationhttps://realpython.com/python-f-strings#internationalization-and-localization
Converting Old String Into F-Strings Automaticallyhttps://realpython.com/python-f-strings#converting-old-string-into-f-strings-automatically
Frequently Asked Questionshttps://realpython.com/python-f-strings#frequently-asked-questions
https://realpython.com/feedback/survey/article/python-f-strings/liked/?from=article-sidebar
https://realpython.com/feedback/survey/article/python-f-strings/disliked/?from=article-sidebar
Python 3's F-Strings: An Improved String Formatting Syntax 52m · 12 lessons https://realpython.com/courses/python-3-f-strings-improved-string-formatting-syntax/
Joanna Jablonskihttps://realpython.com/python-f-strings#author
https://realpython.com/python-f-strings#reader-comments
basicshttps://realpython.com/tutorials/basics/
pythonhttps://realpython.com/tutorials/python/
Interpolating and Formatting Strings Before Python 3.6https://realpython.com/python-f-strings#interpolating-and-formatting-strings-before-python-36
The Modulo Operator (%)https://realpython.com/python-f-strings#the-modulo-operator
The str.format() Methodhttps://realpython.com/python-f-strings#the-strformat-method
Doing String Interpolation With F-Strings in Pythonhttps://realpython.com/python-f-strings#doing-string-interpolation-with-f-strings-in-python
Interpolating Values and Objects in F-Stringshttps://realpython.com/python-f-strings#interpolating-values-and-objects-in-f-strings
Embedding Expressions in F-Stringshttps://realpython.com/python-f-strings#embedding-expressions-in-f-strings
Formatting Strings With Python’s F-Stringhttps://realpython.com/python-f-strings#formatting-strings-with-pythons-f-string
Other Relevant Features of F-Stringshttps://realpython.com/python-f-strings#other-relevant-features-of-f-strings
Using an Object’s String Representations in F-Stringshttps://realpython.com/python-f-strings#using-an-objects-string-representations-in-f-strings
Self-Documenting Expressions for Debugginghttps://realpython.com/python-f-strings#self-documenting-expressions-for-debugging
Comparing Performance: F-String vs Traditional Toolshttps://realpython.com/python-f-strings#comparing-performance-f-string-vs-traditional-tools
Upgrading F-Strings: Python 3.12 and Beyondhttps://realpython.com/python-f-strings#upgrading-f-strings-python-312-and-beyond
Using Quotation Markshttps://realpython.com/python-f-strings#using-quotation-marks
Using Backslasheshttps://realpython.com/python-f-strings#using-backslashes
Writing Inline Commentshttps://realpython.com/python-f-strings#writing-inline-comments
Deciphering F-String Error Messageshttps://realpython.com/python-f-strings#deciphering-f-string-error-messages
Using Traditional String Formatting Tools Over F-Stringshttps://realpython.com/python-f-strings#using-traditional-string-formatting-tools-over-f-strings
Dictionary Interpolationhttps://realpython.com/python-f-strings#dictionary-interpolation
Lazy Evaluation in Logginghttps://realpython.com/python-f-strings#lazy-evaluation-in-logging
SQL Database Querieshttps://realpython.com/python-f-strings#sql-database-queries
Internationalization and Localizationhttps://realpython.com/python-f-strings#internationalization-and-localization
Converting Old String Into F-Strings Automaticallyhttps://realpython.com/python-f-strings#converting-old-string-into-f-strings-automatically
Frequently Asked Questionshttps://realpython.com/python-f-strings#frequently-asked-questions
Remove adshttps://realpython.com/account/join/
Python 3's F-Strings: An Improved String Formatting Syntaxhttps://realpython.com/courses/python-3-f-strings-improved-string-formatting-syntax/
objectshttps://realpython.com/ref/glossary/object/
expressionshttps://realpython.com/ref/glossary/expression/
runtimehttps://realpython.com/ref/computer-science-glossary/runtime/
modulo (%)https://realpython.com/python-modulo-string-formatting/
.format()https://realpython.com/python-formatted-output/#using-the-format-method-for-string-interpolation
string formattinghttps://realpython.com/ref/glossary/string-formatting/
format mini-languagehttps://realpython.com/python-format-mini-language/
string literalhttps://realpython.com/ref/glossary/string-literal/
variablehttps://realpython.com/ref/glossary/variable/
Click here to download the free sample codehttps://realpython.com/bonus/python-f-string-code/
https://realpython.com/quizzes/f-strings/
Python's F-String for String Interpolation and Formattinghttps://realpython.com/quizzes/f-strings/
Python for Beginnershttps://realpython.com/workshops/python-for-beginners/
https://realpython.com/python-f-strings#interpolating-and-formatting-strings-before-python-36
string interpolation operatorhttps://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting
str.format()https://docs.python.org/3/library/stdtypes.html#str.format
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#the-modulo-operator
tuplehttps://realpython.com/python-tuple/
printf()https://en.wikipedia.org/wiki/Printf
Chttps://realpython.com/c-for-python-programmers/
string formatting mini-languagehttps://docs.python.org/3/library/string.html#format-specification-mini-language
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#the-strformat-method
argumentshttps://realpython.com/ref/glossary/argument/
dictionaryhttps://realpython.com/python-dicts/
dictionary unpacking operator (**)https://realpython.com/iterate-through-dictionary-python/#looping-over-merged-dictionaries-the-unpacking-operator
https://realpython.com/python-f-strings#doing-string-interpolation-with-f-strings-in-python
PEP 498https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep498
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#interpolating-values-and-objects-in-f-strings
scopehttps://realpython.com/python-namespaces-scope/
https://realpython.com/python-f-strings#embedding-expressions-in-f-strings
functionhttps://realpython.com/defining-your-own-python-function/
comprehensionshttps://realpython.com/list-comprehension-python/
list comprehensionhttps://realpython.com/list-comprehension-python/
https://realpython.com/python-f-strings#formatting-strings-with-pythons-f-string
.__format__()https://docs.python.org/3/reference/datamodel.html#object.__format__
protocolhttps://realpython.com/python-classes/#special-methods-and-protocols
format()https://docs.python.org/3/library/functions.html#format
the section on .format()https://realpython.com/python-f-strings#the-strformat-method
datetimehttps://realpython.com/python-datetime/
date format specifiershttps://strftime.org/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#other-relevant-features-of-f-strings
https://realpython.com/python-f-strings#using-an-objects-string-representations-in-f-strings
string representationhttps://realpython.com/python-repr-vs-str/#how-can-you-access-an-objects-string-representations
special methodhttps://realpython.com/python-classes/#special-methods-and-protocols
classhttps://realpython.com/ref/glossary/class/
instance attributeshttps://realpython.com/python-classes/#instance-attributes
When Should You Use. .__repr__() vs .__str__() in Python?https://realpython.com/python-repr-vs-str/
instancehttps://realpython.com/ref/glossary/instance/
https://realpython.com/python-f-strings#self-documenting-expressions-for-debugging
debugginghttps://realpython.com/python-debugging-pdb/
print()https://realpython.com/python-print/
self-documented expressionhttps://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#comparing-performance-f-string-vs-traditional-tools
timeithttps://realpython.com/python-timer/#python-timer-functions
for loophttps://realpython.com/python-for-loop/
run the scripthttps://realpython.com/run-python-scripts/
https://realpython.com/python-f-strings#upgrading-f-strings-python-312-and-beyond
3.11https://realpython.com/python311-new-features/
3.12https://realpython.com/python312-f-strings/
PEG parserhttps://realpython.com/python39-new-features/#a-more-powerful-python-parser
3.9https://realpython.com/python39-new-features/
https://realpython.com/python-f-strings#using-quotation-marks
literalshttps://en.wikipedia.org/wiki/Literal_(computer_programming)
SyntaxErrorhttps://realpython.com/invalid-syntax-python/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#using-backslashes
concatenate stringshttps://realpython.com/python-string-concatenation/
escape sequencehttps://realpython.com/ref/glossary/escape-sequence/
https://realpython.com/python-f-strings#writing-inline-comments
commenthttps://realpython.com/ref/glossary/comment/
https://realpython.com/python-f-strings#deciphering-f-string-error-messages
better error messageshttps://realpython.com/python310-new-features/#better-error-messages
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#using-traditional-string-formatting-tools-over-f-strings
https://realpython.com/python-f-strings#dictionary-interpolation
unpackinghttps://realpython.com/ref/glossary/unpacking/
https://realpython.com/python-f-strings#lazy-evaluation-in-logging
logginghttps://realpython.com/python-logging-source-code/
lazilyhttps://realpython.com/python-logging-source-code/#taking-advantage-of-lazy-formatting
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#sql-database-queries
SQL injection attackshttps://realpython.com/prevent-python-sql-injection/
PostgresSQLhttps://realpython.com/python-sql-libraries/#postgresql
Psycopg 2https://pypi.org/project/psycopg2/
https://realpython.com/python-f-strings#internationalization-and-localization
internationalization and localizationhttps://en.wikipedia.org/wiki/Internationalization_and_localization
https://realpython.com/python-f-strings#converting-old-string-into-f-strings-automatically
flynthttps://github.com/ikamensh/flynt
piphttps://realpython.com/what-is-pip/
Remove adshttps://realpython.com/account/join/
https://realpython.com/python-f-strings#frequently-asked-questions
lazy evaluationhttps://realpython.com/ref/computer-science-glossary/lazy-evaluation/
https://realpython.com/quizzes/f-strings/
Python's F-String for String Interpolation and Formattinghttps://realpython.com/quizzes/f-strings/
https://realpython.com/feedback/survey/article/python-f-strings/liked/?from=article-footer
https://realpython.com/feedback/survey/article/python-f-strings/disliked/?from=article-footer
Python 3's F-Strings: An Improved String Formatting Syntaxhttps://realpython.com/courses/python-3-f-strings-improved-string-formatting-syntax/
https://realpython.com/team/jjablonski/
» More about Joannahttps://realpython.com/team/jjablonski/
https://realpython.com/team/acutenco/
Adrianahttps://realpython.com/team/acutenco/
https://realpython.com/team/asantos/
Aldrenhttps://realpython.com/team/asantos/
https://realpython.com/team/bweleschuk/
Brendahttps://realpython.com/team/bweleschuk/
https://realpython.com/team/bzaczynski/
Bartoszhttps://realpython.com/team/bzaczynski/
https://realpython.com/team/damos/
Davidhttps://realpython.com/team/damos/
https://realpython.com/team/dbader/
Danhttps://realpython.com/team/dbader/
https://realpython.com/team/gahjelle/
Geir Arnehttps://realpython.com/team/gahjelle/
https://realpython.com/team/janderson/
Jimhttps://realpython.com/team/janderson/
https://realpython.com/team/kfinegan/
Katehttps://realpython.com/team/kfinegan/
https://realpython.com/team/lpozoramos/
Leodanishttps://realpython.com/team/lpozoramos/
https://realpython.com/team/mbreuss/
Martinhttps://realpython.com/team/mbreuss/
https://realpython.com/team/panni/
Pavelhttps://realpython.com/team/panni/
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-f-strings
Level Up Your Python Skills »https://realpython.com/account/join/?utm_source=rp_article_footer&utm_content=python-f-strings
https://realpython.com/feedback/survey/article/python-f-strings/liked/?from=article-comments
https://realpython.com/feedback/survey/article/python-f-strings/disliked/?from=article-comments
LinkedInhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Frealpython.com%2Fpython-f-strings%2F
Twitterhttps://twitter.com/intent/tweet/?text=Interesting%20Python%20article%20on%20%40realpython%3A%20Python%26%23x27%3Bs%20F-String%20for%20String%20Interpolation%20and%20Formatting&url=https%3A%2F%2Frealpython.com%2Fpython-f-strings%2F
Blueskyhttps://bsky.app/intent/compose?text=Interesting%20Python%20article%20on%20%40realpython.com%3A%20Python%26%23x27%3Bs%20F-String%20for%20String%20Interpolation%20and%20Formatting%20https%3A%2F%2Frealpython.com%2Fpython-f-strings%2F
Facebookhttps://facebook.com/sharer/sharer.php?u=https%3A%2F%2Frealpython.com%2Fpython-f-strings%2F
Get tips for asking good questionshttps://realpython.com/python-beginner-tips/#tip-9-ask-good-questions
get answers to common questions in our support portalhttps://support.realpython.com
Real Python Community Chathttps://realpython.com/community/
“Office Hours” Live Q&A Sessionhttps://realpython.com/office-hours/
basicshttps://realpython.com/tutorials/basics/
pythonhttps://realpython.com/tutorials/python/
I/O Operations and String Formattinghttps://realpython.com/learning-paths/input-output-operations-and-string-formatting/?utm_source=realpython&utm_medium=web&utm_campaign=related-learning-path&utm_content=python-f-strings
Python 3's F-Strings: An Improved String Formatting Syntaxhttps://realpython.com/courses/python-3-f-strings-improved-string-formatting-syntax/?utm_source=realpython&utm_medium=web&utm_campaign=related-course&utm_content=python-f-strings
Python Exceptions: An Introductionhttps://realpython.com/python-exceptions/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-f-strings
Python's Format Mini-Language for Tidy Stringshttps://realpython.com/python-format-mini-language/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-f-strings
Python Web Applications: Deploy Your Script as a Flask Apphttps://realpython.com/python-web-applications/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-f-strings
Logging in Pythonhttps://realpython.com/python-logging/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-f-strings
Python Classes: The Power of Object-Oriented Programminghttps://realpython.com/python-classes/?utm_source=realpython&utm_medium=web&utm_campaign=related-post&utm_content=python-f-strings
https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-f-strings%2F
Continue »https://realpython.com/account/signup/?intent=continue_reading&utm_source=rp&utm_medium=web&utm_campaign=rwn&utm_content=v1&next=%2Fpython-f-strings%2F
Sign-Inhttps://realpython.com/account/login/?intent=continue_reading&next=/python-f-strings/
Start Herehttps://realpython.com/start-here/
Your Learning Planhttps://realpython.com/account/learning-plan/
Browse Topicshttps://realpython.com/tutorials/all/
Learning Resourceshttps://realpython.com/search
Python Referencehttps://realpython.com/ref/
Cheat Sheetshttps://realpython.com/cheatsheets/
Support Centerhttps://support.realpython.com
Mentor AIhttps://realpython.com/mentor/
Learning Pathshttps://realpython.com/learning-paths/
Tutorialshttps://realpython.com/tutorials/
Courseshttps://realpython.com/courses/
Quizzeshttps://realpython.com/quizzes/
Coding Exerciseshttps://realpython.com/coding-exercises/
Live Courseshttps://realpython.com/live/
Bookshttps://realpython.com/books/
Data Sciencehttps://realpython.com/start/data-science-analytics/
AI Apps & Agentshttps://realpython.com/start/ai-apps-agents/
Machine Learninghttps://realpython.com/start/machine-learning/
Automationhttps://realpython.com/start/scripting-automation/
Web Developmenthttps://realpython.com/start/web-development-apis/
Cybersecurityhttps://realpython.com/start/cybersecurity/
Podcasthttps://realpython.com/podcasts/rpp/
Newsletterhttps://realpython.com/newsletter/
Community Chathttps://realpython.com/community/
Office Hourshttps://realpython.com/office-hours/
Learner Storieshttps://realpython.com/learner-stories/
Plans & Pricinghttps://realpython.com/account/join/
Team Planshttps://realpython.com/account/join-team/
For Businesshttps://realpython.com/account/join-team/inquiry/
For Schoolshttps://realpython.com/account/join-team/education-inquiry/
Reviewshttps://realpython.com/learner-stories/
About Ushttps://realpython.com/about/
Teamhttps://realpython.com/team/
Mission & Valueshttps://realpython.com/mission/
Editorial Guidelineshttps://realpython.com/editorial-guidelines/
Sponsorshipshttps://realpython.com/sponsorships/
Careershttps://realpython.workable.com
Press Kithttps://realpython.com/media-kit/
Merchhttps://realpython.com/merch
https://www.youtube.com/realpython
https://x.com/realpython
https://www.linkedin.com/company/realpython-com
https://www.facebook.com/LearnRealPython
https://github.com/realpython/
Privacy Policyhttps://realpython.com/privacy-policy/
Terms of Usehttps://realpython.com/terms/
Securityhttps://realpython.com/security/
Contacthttps://realpython.com/contact/
https://realpython.com/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.