Python String title() Method

The Python title() method is used to return a string where the first character in every word is upper case, and the remaining characters are lower case. It returns a new string with the title cased version of the original string.

For example:

text = "hello world"
result = text.title()
print(result)

# Output: Hello World

You can also use title() on a string that contains numbers or symbols. The first letter after any number or symbol will be converted to upper case.

For example:

text = "234 k3l2 *43 fun"
result = text.title()
print(result)

# Output: 234 K3L2 *43 Fun

If you have any questions about this code, you can drop a line in comment.

Comments

Popular posts from this blog

Python chr() Built in Function

Stock Market Predictions with LSTM in Python

Collections In Python

Python Count Occurrence Of Elements

Python One Liner Functions