Thursday, 17 December 2020

Python: Change each word of string to title case

‘title()’ method is used to change each word of string to title case, where each word start with a capital letterxz.

 

title_case.py

message = "python is a friendly language to experiment"

print(message.title())

 Output

$python3 title_case.py 
Python Is A Friendly Language To Experiment



 

Previous                                                    Next                                                    Home

No comments:

Post a Comment