Python判断字符串是否为数字

str为字符串
1、str.isalnum() 所有字符都是数字或者字母
2、str.isalpha() 所有字符都是字母
3、str.isdigit() 所有字符都是数字
4、str.islower() 所有字符都是小写
5、str.isupper() 所有字符都是大写
6、str.istitle() 所有单词都是首字母大写
7、str.isspace() 所有字符都是空白字符、\t、\n、\r

猜你喜欢

转载自blog.csdn.net/weixin_40874592/article/details/84777146