Python判断字符串是否全是字母或数字

python学习网 2018-09-15 19:34:02

str.isnumeric(): True if 只包含数字;otherwise False。注意:此函数只能用于unicode string

str.isdigit(): True if 只包含数字;otherwise False。

str.isalpha():True if 只包含字母;otherwise False。

str.isalnum():True if 只包含字母或者数字;otherwise False。

阅读(2112) 评论(0)