“Python Print f” Kod odpowiedzi

Python Print f

From geeksforgeeks:
"PEP 498 introduced a new string formatting mechanism known as Literal 
String Interpolation or more commonly as F-strings (because of the leading f 
character preceding the string literal). The idea behind f-strings is to 
make string interpolation simpler"

Example

name = 'Michael'

print(f"My name is {name}")
MitchAloha

Drukuj (f) Python

my_var = "world"
print(f"hello {my_var}")
# hello world
Plif Plouf

Odpowiedzi podobne do “Python Print f”

Pytania podobne do “Python Print f”

Więcej pokrewnych odpowiedzi na “Python Print f” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu