String isalpha() method
kodingwindow@kw:~$ python3
...
>>> s="Hello World!"
>>> s.isalpha()
False

>>> s="Hello World"
>>> s.isalpha()
False

>>> s="HelloWorld"
>>> s.isalpha()
True
String isalnum() method
>>> s="Hello World!"
>>> s.isalnum()
False

>>> s="Hello World"
>>> s.isalnum()
False

>>> s="13HelloWorld13"
>>> s.isalnum()
True
String isdigit() method
>>> s="13HelloWorld13"
>>> s.isdigit()
False

>>> s="1313"
>>> s.isdigit()
True

>>> s="13.13"
>>> s.isdigit()
False

>>> s="\u00B2"
>>> s.isdigit()
True
String isdecimal() method
>>> s="\u00B2"    # to the power 2
>>> s.isdecimal()
False

>>> s="0123456789"
>>> s.isdecimal()
True

>>> s="\u00BD"    # 1/2
>>> s.isdecimal()
False
String isnumeric() method
>>> s="\u00B2"
>>> s.isnumeric()
True

>>> s="0123456789"
>>> s.isnumeric()
True

>>> s="1/2"
>>> s.isnumeric()
False

>>> s="\u00BD"    # 1/2
>>> s.isnumeric()
True
String isspace() method
>>> s="Hello World!"
>>> s.isspace()
False

>>> s="       "
>>> s.isspace()
True
String istitle() method
>>> s="Hello World!"
>>> s.istitle()
True

>>> s="hello world!"
>>> s.istitle()
False
String islower() and isupper() methods
>>> s="hello world!"
>>> s.islower()
True

>>> s="HELLO, WORLD!"
>>> s.isupper()
True

>>> s="Hello, World!"
>>> s.islower()
False

>>> s.isupper()
False
Advertisement