What is the difference between an f-string and a string.format() method? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 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 Réponses
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