isX字符串方法

islower():返回True,如果字符串至少有一个字母,并且所有字母都是小写;

                   例如:>>> spam='Hello world'

                              >>> spam.islower()

                                       False

isupper():返回True,如果字符串至少有一个字母,并且所有字母都是大写;

                   例如:>>> 'HELLO'.isupper()

                                       True

isalpha():返回True,如果字符串只包含字母,并且非空;

                   例如:>>> 'hello'.isalpha()

                                      True

isalnum():返回True,如果字符串只包含字母和数字,并且非空;

                   例如:>>> 'hello123'.isalnum()

                                     True

isdecimal():返回True,如果字符串只包含数字字符,并且非空;

                   例如:>>> '123'.isdecimal()

                                        True

isspace():返回True,如果字符串只包含空格、制表符和换行,并且非空;

                   例如:>>> '    '.isspace()

                                     True

istitle():返回True,如果字符串仅包含以大写字母开头、后面都是小写字母的单词;

                   例如:>>> 'This Is Title Case'.istitle()

                                      True

原文地址:https://www.cnblogs.com/cqkangle/p/10435738.html