반응형
python = "Python"
print("h " + python[3]) # Note: string indexing starts with 0
p_letter = python[0]
print(p_letter)
산출물 (Output)
h h
P
* 글자의 위치를 안다면 문자열의 글자에 접근할 수 있습니다. 예를 들어, str[index]는 문자열 'str" 안의 ‘index’ 위치에 있는 글자를 yield 합니다. string index는 항상 0에서 시작된다는 것을 알아야 합니다.
반응형
'Python 배우기' 카테고리의 다른 글
slicing.py (0) | 2016.03.06 |
---|---|
negative_indexing.py (0) | 2016.03.06 |
string_multiplication.py (0) | 2016.03.06 |
concatenation.py (0) | 2016.03.06 |
비교 연산자 comparison_operators.py (0) | 2016.03.06 |
댓글