본문 바로가기
Python

f-string

by 벤진[Benzene] 2020. 8. 12.

f-string(formated string literal)

https://www.python.org/dev/peps/pep-0498/#:~:text=These%20include%20%25%2Dformatting%20%5B1,%5B2%5D%2C%20and%20string.&text=It%20should%20be%20noted%20that,which%20contains%20expressions%20inside%20braces.

 

PEP 498 -- Literal String Interpolation

The official home of the Python Programming Language

www.python.org

index = 1
example = "hello"

print(f'{index+1}:{example}')
--> 2: hello

'Python' 카테고리의 다른 글

Regular expression operation (re.sub)  (0) 2020.08.16
Enumerate  (0) 2020.08.12
Type Hint  (0) 2020.08.11

댓글