Home >>Python String Methods >Python String capitalize() Method

Python String capitalize() Method

Python String capitalize() Method

Python string capitalize() method is used to return the given input string with the first character of the string is upper case.

Syntax:
string.capitalize()
Here is an example of Python capitalize() method:

txt = "welcome to PHPTPOINT."
x = txt.capitalize()
print (x)

Output:
Welcome to phptpoint.
Example 2:

txt = "28 out of 50 students have scored above 90% in the test."
x = txt.capitalize()
print (x)

Output:
28 out of 50 students have scored above 90% in the test.

No Sidebar ads