python-str判断字符串是字母 数字 大小写还是空格

官方API  https://docs.python.org/2/library/stdtypes.html?highlight=str%20isspace#str.isalnum 

str.isalnum()  所有字符都是数字或者字母,为真返回 Ture,否则返回 False。
str.isalpha()   所有字符都是字母(当字符串为中文时, 也返回True),为真返回 Ture,否则返回 False。
str.isdigit()     所有字符都是数字,为真返回 Ture,否则返回 False。
str.islower()    所有字符都是小写,为真返回 Ture,否则返回 False。
str.isupper()   所有字符都是大写,为真返回 Ture,否则返回 False。
str.istitle()      所有单词都是首字母大写,为真返回 Ture,否则返回 False。
str.isspace()   所有字符都是空白字符,为真返回 Ture,否则返回 False。
原文地址:https://www.cnblogs.com/onenoteone/p/12441773.html