단어의 첫 글자를 대문자로 바꿔주는 메소드
s = "abcd"
print(s.capitalize()) # 'Abcd'
문장의 첫 글자를 대문자로 바꿔주는 메소드
s1 = "abcd"
print(s1.title()) # 'Abcd'
s2 = "hello world"
print(s2.title()) # 'Hello World'
이 때, 알파벳이 아닌 다른 문자들
을 기준으로 단어를 구분한다는 점에 주의해야 한다.
s1 = "a1b2c3"
print(s1.capitalize()) # 'A1b2c3'
print(s1.title()) # 'A1B2C3'
s2 = "abc-def gh"
print(s2.capitalize()) # 'Abc-def gh'
print(s2.title()) # 'Abc-Def Gh