1 개요[ | ]
- 파이썬 대소문자 변환
- 파이썬 문자열 대소문자 변환
- Python 문자열 대소문자 변환
2 upper(): 대문자로[ | ]

Python
Copy
s = "HELLO World"
print( s.upper() ) # HELLO WORLD
print( s ) # HELLO World
Loading
- → 원본에는 변화가 없다.
3 lower(): 소문자로[ | ]

Python
Copy
s = "HELLO World"
print( s.lower() ) # hello world
print( s ) # HELLO World
Loading
4 capitalize()[ | ]

- 문자열의 첫글자는 대문자로, 나머지는 소문자로 변환한다.
Python
Copy
print ( 'hello world!'.capitalize() ) # Hello world!
print ( 'HELLO WORLD!'.capitalize() ) # Hello world!
Loading
5 title()[ | ]

- 문자열 내 띄어쓰기 기준으로 각 단어의 첫글자는 대문자로, 나머지는 소문자로 변환한다.
Python
Copy
print( 'hello, world!'.title() ) # Hello, World!
Loading
Python
Copy
print( 'FooBar'.title() ) # Foobar
Loading
6 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.