Python3 istitle() Method

Python3 字符串Python3 Strings


Description

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

Syntax

Syntax of the 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, it returns False.

Example

The following example demonstrates the istitle() method:

Example

#!/usr/bin/python3 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 as follows:

True
False

Python3 字符串Python3 Strings

Other Extensions