Python OOPs


Python SQLite


Examples


Others


capitalize() method in Python


The capitalize() method returns a string with its first character capitalized.

Syntax
string.capitalize()

Write a Python program to converts the first character to Capital using capitalize() method.

Example
a="this is sample text"
print(a.capitalize())

b="THIS IS SAMPLE TEXT"
print(b.capitalize())

c="this is SAMPLE text"
print(c.capitalize())

Output

This is sample text
This is sample text
This is sample text    

Python String Methods