Python isalpha

Python isalpha 方法用于检查给定字符串是否至少包含一个字符,以及该字符是字母还是非字母。在本节中,我们将通过一个示例讨论如何编写 string isalpha 函数,其语法如下:

String_Value.isalpha()

isalpha 函数用于检查是否为字母

以下示例集可帮助您理解该函数。请参阅字符串方法文章以在Python中理解它们。

Str1 = 'TutorialGateway';
print('First Output of a method is = ', Str1.isalpha())

# Performing on Empty Space
Str2 = '     ';
print('Second Output of For Empty Space is = ', Str2.isalpha())

# Performing directly on Alphabets
Str3 = 'Learn Tutorial at Tutorial Gateway'.isalpha()
print('Third Output is = ', Str3)

# Performing on both Digits and Alphabets
Str4 = '1239abcd'.isalpha()
print('Fourth Output of is = ', Str4)

# Performing on Special Characters
Str5 = '@@@!!!!'.isalpha()
print('Fifth Output of a is = ', Str5)
isalpha to check Character is alphabet