Python-字符串内容检测

str.isnumeric()

  检测字符串是否只由数字组成

str.isalpha()

  检测字符串是否只由字母组成

str.islower()

  检测字符串中所有的字母是否都为小写

str.isupper()

  检测字符串中所有的字母是否都为大写

 

更多isxxx()方法请参考

https://docs.python.org/3/library/stdtypes.html#string-methods

posted @ 2020-07-09 22:46  renjieyi  阅读(979)  评论(0)    收藏  举报