logo

Python String Isalpha() Method


Show

Description

The isalpha() method in Python String checks whether the string consists of alphabetic characters only. In Python string, the isalpha() method is built-in and is utilized for string handling. This method of Python string is known to return “True” if every character within the string is an alphabet else, It returns “False”.

Syntax

Here is the syntax for islpha() method -

str.isalpha()

Parameters

  • NA

Return Value

This method returns true in case all characters are alphabetic in the string and there lies at least one character, otherwise, it would return false.

Example

The following example makes use of isalpha() method.

#!/usr/bin/python

str = "this";  # No space & digit in this string
print str.isalpha()

str = "this is string example....wow!!!";
print str.isalpha()

When we run the above program, it produces the following result:

True
False

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.