Python String capitalize() Method

The capitalize() method converts the first character of a string to an uppercase letter and all other alphabets to lowercase. For example:

sentence = "i love PYTHON"

# converts first character to uppercase and others to lowercase
capitalized_string = sentence.capitalize()
print(capitalized_string)
# Output: I love python

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