파이썬은 물론이고 모든 프로그래밍 언어에서 문자열 처리는 매우 중요하다. 파이썬의 경우 문자열 처리를 쉽게 할 수 있도록 기본적으로 제공해주는 문자열 메소드들이 많기 때문에 몇가지를 정리해보고자 한다.
문자열 변경(변환)

- .capitalize(): 앞글자만 대문자로 변경
- .title(): 각 단어의 앞글자를 대문자로 변경
- .swapcase(): 소문자는 대문자로, 대문자는 소문자로 변경

- .strip(): 문자열 양쪽 끝을 자른다. 제거할 문자를 인자로 전달
- .lstrip(): 문자열 왼쪽을 자름
- .rstrip(): 문자열 오른쪽을 자름

- .replace(): 특정 문자열 변경(대체)
- .format(): 틀을 만들어놓고 문자열 생성
- .join(): 리스트 같은 iterable 인자 전달하여 문자열로 연결
문자열 분리(나누기)

- .partition(): 전달한 문자로 문자열 분리. 결과는 튜플 형태.
- .rpartition(): 뒤에서부터 전달한 문자로 분리.
- .split(): 전달한 문자로 문자열 나눔. 결과는 리스트 형태.
- .rsplit(): 뒤에서부터 전달한 문자열로 문자열 나눔.
문자열 종류 판단
is로 시작하는 메소드(함수)의 결과는 bool(True, False)이다.
- .isalnum(): 알파벳인가 숫자인가
- .isalpha(): 알파벳인가
- .isdecimal(): 숫자(decimal, 10진수)인가
- .isdigit(): 숫자(digit, 10진수)인가
- .isidentifier(): 식별자로 사용가능한가 ex) book - True / age@ - False
- .istitle(): 앞글자가 대문자인 title 형식인가
- .isupper(): 대문자인가
문자열 확인

- .count(): 특정 단어(문자열)의 수를 구함 (없으면 0 리턴)
- .find(): 특정 단어를 찾아 인덱스를 리턴 (없으면 -1 리턴)

- .index(): find()와 동일하나, 예외를 발생시킨다.