일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 상태
- 강화학습
- grid
- margin
- 에라토스테네스의 체
- Flexbox
- 포토샵
- Javascript
- stl
- Gap
- skt membership
- Photoshop
- align-items
- Codility
- Prefix Sums
- spring
- c
- 백준
- pandas
- CSS
- 수학
- 통신사할인
- 소수
- SK바이오사이언스
- c++
- 알고리즘
- series
- 확률
- Design Pattern
- dataframe
Archives
- Today
- Total
sliver__
[Python] - 문자열 처리 함수 본문
728x90
python = "Python is Amazing" # 문자열 선언
print(python.lower()) # python is amazing, 소문자로 변환
print(python.upper()) # PYTHON IS AMAZING, 대문자로 변환
print(python[0].isupper()) # python 0번 index가 uppercase 인지 확인
print(len(python)) # python 문자열 변수의 길이를 반환
print(python.replace("Python", "Java")) # Python 문자열을 Java 문자열으로 대체
index = python.index("n") # 문자n이 있는 index 번호를 반환
print(index)
index = python.index("n", index + 1) #문자 n의 다음 index 번호를 반환
print(index)
print(python.find("Python")) # Python 문자열이 있는 첫번째 문자의 index 반환
print(python.find("Java")) # Java 문자열이 없다면 -1 반환
# print(python.index("Java")) # compile error return
print(python.count("n")) # n 문자의 개수 count
728x90
'CS > Python' 카테고리의 다른 글
[Python] - 탈출 문자 (0) | 2022.12.13 |
---|---|
[Python] - 문자열 포맷 (0) | 2022.12.13 |
[Python] - 랜덤 함수 (0) | 2022.12.13 |
[Python] - 숫자 처리 함수 (0) | 2022.12.13 |
[Python] - 반복문 (0) | 2022.03.28 |
Comments