English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Check if all the words in the string are spelled with the first letter capitalized and the other letters are lowercase. If they are, the istitle() returns True. If not, it returns False.
The syntax of the istitle() method is:
string.istitle()
istitle() method does not take any parameters.
istitle() method returns:
If all the words in the string are spelled with the first letter capitalized and the other letters are lowercase, it returns True, otherwise it returns 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())
When running the program, the output is:
True False True True False
s = 'I Love Python.' if s.istitle() == True: print('istitle() is true') else: print('istitle() is false') s = 'PYthon' if s.istitle() == True: print('istitle() is true') else: print('istitle() is false')
When running the program, the output is:
istitle() is true istitle() is false