Python 3 reference · String Methods

Python String capitalize() Method

Return a copy of the string with the first character in upper case and the rest in lower case.

Python 3 Since 3.0

Syntax

str.capitalize()

Return value

A new string.

Examples

Basic useTry it yourself
print("hello WORLD".capitalize())

Output

Hello world
Accents and leading digitsTry it yourself
print("élan".capitalize(), "123abc".capitalize())

Output

Élan 123abc

Good to know

capitalize() lower-cases everything after the first character. To upper-case the first letter of every word, use title(); to change only the first character, use s[:1].upper() + s[1:].

Version history

VersionChange
Python 3.0Added