Character Letter Check करना
आप String Class से isalpha() Method का उपयोग कर सकते हैं। यह Check करता है कि String केवल Alphabets से बना है या नहीं। आप इसका उपयोग यह Check करने के लिए भी कर सकते हैं कि कोई Character Alphabet है या नहीं।
उदाहरण: 5th Index पर Character Check करना
>>> s = "Hello people" >>> s[4].isalpha() True
पूरे String को Check करना
आप पूरे Strings को भी Check कर सकते हैं कि वे Alphabetic हैं या नहीं।
>>> s = "Hello people" >>> s.isalpha() False >>> "Hello".isalpha() True
Related Methods:
| Method | Description |
|---|---|
isalpha() |
केवल Letters (Unicode Letters शामिल) |
isdigit() |
केवल Digits (0-9) |
isalnum() |
Letters या Digits |
isnumeric() |
Numeric Characters (Fractions, Roman Numerals शामिल) |
isdecimal() |
Decimal Characters केवल |
isspace() |
Whitespace Characters |
Unicode Support:
>>> 'α'.isalpha() # Greek Alpha True >&>> '漢'.isalpha() # Chinese Character True >>> '1'.isalpha() False