Method Name:
capitalize
Method signature:
capitalize()
Method Overview:
- The capitalize() method of Python str class returns a copy of a python string object with the following modifications done:
- The first character of the string is capitalized
- All other characters of the string except the first character are made lower case.
Example:
# String with lower case and upper case letters aliceQuote = "Curiouser And Curiouser!"; print(aliceQuote.capitalize())
# String with all lower case letters aliceQuote = "begin at the beginning"; print(aliceQuote.capitalize()) |
Output:
Curiouser and curiouser! Begin at the beginning |