반응형

프로그래밍 8

[파이썬 기본편_14] 문자열 슬라이싱 a[ : : ]

슬라이싱: 범위를 정한 부분을 가져옴 a = "Life is too short, You need Python" print(a[0:4]) a[0:4] --> a의 0번째부터~4미만까지 가져와~~~~ 출력값: Life a = "Life is too short, You need Python" b = a[19:] print(b) a[19: ] : a의 19번째부터 끝까지 출력값: You need Python 2. a = "Life is too short, You need Python" b = a[:] print(b) a[ : ] --> a의 처음부터 끝까지 출력값: Life is too short, You need Python 3. a = "Life is too short, You need Python" b =..

12. Python 2023.08.24
반응형