Python istitle() Method

Python 字符串Python String


Description

Python istitle() method checks whether the first letter of all words in the string is uppercase and the other letters are lowercase.

Syntax

Syntax of istitle() method:

str.istitle()

Parameters

  • None.

Return Value

Returns True if the first letter of all words in the string is uppercase and the other letters are lowercase; otherwise returns False.

Example

The following example demonstrates the use of the istitle() method:

#!/usr/bin/python


str = "This Is String Example...Wow!!!";
print str.istitle();

str = "This is string example....wow!!!";
print str.istitle();

The output of the above example is:

True
False

Python 字符串Python String

Other Extensions