문자열(string) (2)

1. upper 메서드 : 대문자 변경

2. lower 메서드 : 소문자 변경

3. capitalize 메서드 : 첫글자 대문자 변경

4. startswith, endswith 메서드 : 시작글자 끝글자 확인(Bool) -> 크롤링 및 전처리 활용 / 인자가 두개일 때 : 괄호추가

file_name = "2020_보고서.xlsx"
file_name.startswith("2021")
False
file_name.endswith(("xlsx","xls"))
True

5. split 메서드 : 문자열 나누기

a = "hello world"
print(a.split(" "))
a
['hello', 'world']
'hello world'

 

 

'Data Science > python' 카테고리의 다른 글

01. 데이터 불러오기 및 데이터 확인  (0) 2021.12.21
리스트(list)  (0) 2021.12.19
문자열(string) (1)  (0) 2021.12.19
자료형 변환  (0) 2021.12.19
print 함수  (0) 2021.12.19