Capitalize the first letter of each word in a String in Python
In this post we will give you information about Capitalize the first letter of each word in a String in Python. Hear we will give you detail about Capitalize the first letter of each word in a String in PythonAnd how to use it also give you demo for it if it is necessary.
we are going to learn about how to capitalize or uppercase the first letter of a each word in a given string in Python.
Consider, we have a following string:
a = "how are you python"
Now we need to capitalize the first letter of each word in the above string like this:
How Are You Python
Using the title() method
To capitalize the first letter of each word in a string, we can use the built-in title() method in Python.
Here is an example:
a = "how are you python"print(a.title())
Output:
How Are You Python
Hope this code and post will helped you for implement Capitalize the first letter of each word in a String in Python. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs
