Data Analysis/Python
input()
yeorii
2023. 3. 8. 13:53
큰따옴표(")로 둘러싸인 문자열은 + 연산과 동일하다
>>> print("life" "is" "too short") # 1
lifeistoo short
>>> print("life"+"is"+"too short") # 2
lifeistoo short
위 예에서 1과 2는 완전히 동일한 결괏값을 출력한다. 즉 따옴표로 둘러싸인 문자열을 연속해서 쓰면 + 연산을 한 것과 같다.
문자열 띄어쓰기는 콤마로 한다
>>> print("life", "is", "too short")
life is too short
콤마(,)를 사용하면 문자열 사이에 띄어쓰기를 할 수 있다.