반응형
위키독스 링크: https://wikidocs.net/13
문자형으로 만드는 4가지 방법
"Hello World"
'Hello World'
"""Life is too short, You need python"""
'''Life is too short, You need python'''
- 1번
a = "Life is too short, You need Python"
b = "a"
c = "123"
print(type(a))
출력값: <class 'str'>
- str: string(문자)의 약자
- 2번 (문자열 안에 큰 따옴표를 넣고 싶다면)
a = 'Life is too short, You need "Python"'
print(a)
출력값: Life is too short, You need "Python"
- 3번 (작은따옴표 앞에 백 슬래쉬 \)
a = 'I\'m hungry'
print(a)
출력값: I'm hungry
- 4번 (큰 따옴표 앞에 백 슬래쉬 \)
a = "Life is too short, You need \"Python\""
print(a)
출력값: Life is too short, You need "Python"

반응형
'12. Python' 카테고리의 다른 글
[파이썬 기본편_9] 역슬래시 \ 기능 모음 (0) | 2023.08.22 |
---|---|
[파이썬 기본편_8] 줄 바꿈 (0) | 2023.08.22 |
VSCode에서 터미널(Terminal) 출력값 삭제하는 단축키(윈도우, 맥) (0) | 2023.08.22 |
[파이썬 기본편_6] 사칙연산(더하기, 빼기, 곱하기, 나누기, 몫) (0) | 2023.08.22 |
[파이썬 기본편_5] 변수란? (0) | 2023.08.22 |