Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python isalpha() method

Python isalpha() method

Python Strings Python Strings


Description

The Python isalpha() method checks whether a string consists only of letters.

Syntax

Syntax of the isalpha() method:


str.isalpha()

Parameters

Return Value

Returns True if the string has at least one character and all characters are letters, otherwise returns False.

Example

The following example demonstrates the isalpha() method:

Example

#!/usr/bin/python

coding=utf-8

str

=

"runoob"

;

print

str

.

isalpha

(

)

;

str

=

"runoobRunoob Tutorial"

;

print

str

.

isalpha

(

)

;

str

=

"this is string example....wow!!!"

;

print

str

.

isalpha

(

)

;

The output of the above example is:


True
False
False

Python Strings Python Strings