python) Concatenating Text Strings
" Concatenating Text Strings "
문자열의 더하기
string 을 이어야 할 때
string + string 형태로 사용할 수 있다.
print("hello" + "world")
# 출력
실행결과> helloworld
literal string interpolation
- 문자 따옴표 앞에 f 를 붙인다.
- 치환하고 싶은 변수를 { } 을 사용해서 표시한다.
( 꼭 변수가 아니어도 된다, 함수 호출이 될 수도 있다.)
예)
date = 1980
python_inventor = "Guido van Rossum"
location = "Centrum Wiskunde & Informatica"
country = "Netherlands"
print(f"""Python was conceived in the late {date}s
by {python_inventor} at {location} (CWI) in the {country} as a successor
to the ABC language (itself inspired by SETL), capable of exception handling
and interfacing with the Amoeba operating system.
Its implementation began in December 1989.""")
# 출력
실행결과>
Python was conceived in the late 1980s
by Guido van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands as a successor
to the ABC language (itself inspired by SETL), capable of exception handling
and interfacing with the Amoeba operating system.
Its implementation began in December 1989.
Author And Source
이 문제에 관하여(python) Concatenating Text Strings), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@ssoulll/python-Concatenating-Text-Strings저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)