Python isnumeric()方法
描述
Python isnumeric() 方法检测字符串是否只由数字组成。这种方法是只针对unicode对象。
注: 定义一个字符串为Unicode,只需要在字符串前添加 'u' 前缀即可,具体可以查看本章节例子。
语法
isnumeric()方法语法:
str.isnumeric()
参数
- 无。
Python isnumeric() 方法检测字符串是否只由数字组成。这种方法是只针对unicode对象。
注: 定义一个字符串为Unicode,只需要在字符串前添加 'u' 前缀即可,具体可以查看本章节例子。
isnumeric()方法语法:
str.isnumeric()