Thursday, 23 September 2021

Python: Convert first letter of each word to upper case

‘title’ method return the title case version of given string.

 

string_title_case.py

str = 'hello world, How are you'

print('str -> ', str)
print('str in title case -> ', str.title())

 

Output

str ->  hello world, How are you
str in title case ->  Hello World, How Are You

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment