capitalize() String Method in Python with Examples
capitalize()
returns a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
Example: capitalize() String Method
message = 'welcome to python 123!'
print('Original string: %s' %(message))
print('After capitalization: %s' %(message.capitalize()))
# OR
print('After capitalization: %s' %(str.capitalize(message)))
Output
Original string: welcome to python 123! After capitalization: Welcome to python 123!
Related String Methods