본문 바로가기

Python

[Python] 문자열 소문자 또는 대문자로 바꾸기

1. string.upper()

string내부의 모든 알파벳을 대문자로 바꿔주는 함수이다.

예시

1
2
str = "abcd"
print(str.upper()) #"ABCD"가 출력된다.
cs

2. string.lower()

string내부의 모든 알파벳을 소문자로 바꿔주는 함수이다.

예시

1
2
str = "ABCD"
print(str.lower()) #"abcd"가 출력된다.
cs

'Python' 카테고리의 다른 글

[Python] lambda & map & reduce  (0) 2021.01.06
[Python] join과 split  (0) 2021.01.05
[python] 2차원 배열 선언  (0) 2020.09.30
[Python] 모듈과 패키지 그리고 프로젝트  (0) 2020.09.22
[Python] id( object ) 함수  (0) 2020.08.01