Notice
Recent Posts
Recent Comments
Link
목록해시태그 (1)
SeouliteLab
[Python/파이썬] 문자열을 대문자로 변환하는 방법
1. upper() 메서드 활용 Python의 문자열 객체는 upper() 메서드를 통해 간편하게 대문자로 변환할 수 있습니다. 이 메서드는 문자열 내의 모든 소문자를 대문자로 바꿉니다. text = "hello, world!" upper_text = text.upper() print(upper_text) # 출력 결과: HELLO, WORLD! 2. 대문자와 소문자가 혼합된 문자열에서 사용하기 upper() 메서드는 이미 대문자인 문자나 숫자, 그리고 구두점 등에는 영향을 미치지 않습니다. 대소문자가 혼합된 문자열에서도 동작합니다. mixed_text = "Hello, WoRlD!" upper_mixed_text = mixed_text.upper() print(upper_mixed_text) # 출력 ..
프로그래밍
2024. 3. 2. 12:25