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

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。

猜你喜欢

转载自www.cnblogs.com/liuyihua1992/p/9649739.html