English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
문자열에서 모든 단어의 첫 글자가 대문자이고 나머지 글자가 소문자인지 확인합니다. 만약 그렇다면 istitle()가 True를 반환하고, 그렇지 않으면 False를 반환합니다.
istitle() 메서드의 문법은 다음과 같습니다:
string.istitle()
istitle() 메서드는 어떤 매개변수도 가져いません.
istitle() 메서드 반환
문자열에서 모든 단어의 첫 글자가 대문자이고 나머지 글자가 소문자인 경우 True를 반환하고, 그렇지 않으면 False를 반환합니다.
s = 'Python Is Good.' print(s.istitle()) s = 'Python is good' print(s.istitle()) s = 'This Is @ Symbol.' print(s.istitle()) s = ''99 Is A Number print(s.istitle()) s = 'PYTHON' print(s.istitle())
이 프로그램을 실행할 때, 출력은 다음과 같습니다:
True False True True False
s = 'I Love Python.' if s.istitle() == True: print('istitle()가 true') else: print('istitle()가 false') s = 'PYthon' if s.istitle() == True: print('istitle()가 true') else: print('istitle()가 false')
이 프로그램을 실행할 때, 출력은 다음과 같습니다:
istitle()가 true istitle()가 false