What is usage of {} in f string? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

What is usage of {} in f string?

15th Aug 2022, 1:10 PM
Amzara
1 ответ
+ 5
Also called “formatted string literals,” f-strings are string literals that have an f at the beginning and curly braces containing expressions that will be replaced with their values. The expressions are evaluated at runtime and then formatted using the __format__ protocol. Eg: x = 7 print (f"T he value of x is {x}")
15th Aug 2022, 1:29 PM
Sreeju
Sreeju - avatar