What is the difference between an f-string and a string.format() method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference between an f-string and a string.format() method?

In python, what is different when we use f-string and the format method on a string. Please tell if both works similarly or is there any difference in both's working.

3rd Jun 2022, 10:01 AM
Dev 🇮🇳
Dev 🇮🇳 - avatar
2 Answers
3rd Jun 2022, 1:20 PM
Per Bratthammar
Per Bratthammar - avatar
0
Both are used for the same thing. F strings are just better
3rd Jun 2022, 10:07 AM
Slick
Slick - avatar