The string capitalize() method is used to return the string with first character of the specified string into uppercase and rest into lowercase. Any symbol, space, special character or number in the string is ignored while applying this function. Only Alphabets are converted. Please note that it does not change the original string and only returns the converted version of the given string.
No parameter is required.
In the below example, capitalize() method is used to convert first character of the string called MyString into uppercase and rest into lowercase. This method does not change the MyString and only returns the converted version of it.
MyString = "heLLo woRld!" NewString = MyString.capitalize() print(MyString) print(NewString)
heLLo woRld! Hello world!