Change language

Python String | istitle ()

|

what is titlecased?

A string with the first character in each word in uppercase and all remaining characters in lowercase.

Syntax :

string.istitle ()

Parameters :

The istitle () method doesn’t take any parameters.

string otherwise it returns False.

CODE 1

# First character in each word
# uppercase and remaining lowercase

s = ’ Geeks For Geeks’

print (s.istitle ())

  
# First character in first
# lowercase word

s = ’geeks For Geeks’

print (s.istitle ())

 
# Third word in uppercase
# characters in the middle

s = ’Geeks For GEEKs’

print (s.istitle ())

 

s = ’ 6041 Is My Number’

print (s.istitle ())

 
# uppercase word
# characters in the 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 ( < code class = "string"> ’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 

Python String | istitle () Python functions: Questions

Python String | istitle () String Variables: Questions

Shop

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method