by @codeexamples

How to capitalize the first letter of every word in string Python

Home » python » How to capitalize the first letter of every word in string Python

To capitalize the first letter of every word in a string, we can use the title() method in Python.

Here is an example which capitalizes the first letter of every word in the following string.

a = "how are you python"

print(a.title())

Output:

How Are You Python