Python String | istitle()
The istitle() returns True if the string is a titlecased string otherwise it returns False.
what is titlecased ?
String which has the first character in each word Uppercase and remaining all characters Lowercase alphabets.
Syntax :
string.istitle()
Parameters :
The istitle() method doesn’t take any parameters.
Returns :
returns True if the string is a titlecased string otherwise it returns False.
CODE 1
# First character in each word is # uppercase and remaining lowercases s = 'Geeks For Geeks'print(s.istitle()) # First character in first # word is lowercase s = 'geeks For Geeks'print(s.istitle()) # Third word has uppercase # characters at middle s = 'Geeks For GEEKs'print(s.istitle()) s = '6041 Is My Number'print(s.istitle()) # word has uppercase # characters at middle s = 'GEEKS'print(s.istitle()) |
Output :
True False False True False
CODE 2
s = 'I Love Geeks For Geeks' if s.istitle() == True: print('Titlecased String') else: print('Not a Titlecased String') s = 'I Love geeks for geeks' if s.istitle() == True: print('Titlecased String') else: print('Not a Titlecased String') |
Output :
Titlecased String Not a Titlecased String
Recommended Posts:
- numpy string operations | istitle() function
- String slicing in Python to check if a string can become empty by recursive deletion
- Python | Check if given string can be formed by concatenating string elements of list
- Python | Merge Tuple String List values to String
- Python | Check if string ends with any string in given list
- Python | Sorting string using order defined by another string
- Python | Check if a given string is binary string or not
- String slicing in Python to rotate a string
- Python | Sort each String in String list
- Python String | max()
- Python String | min()
- Python String
- Python | Add one string to another
- casefold() string in Python
- Python - Get Nth word in given String
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


