isdigit() isnumeric()函数

1 二者都无法直接判断字符串中的负数,

# 都无法判断字符串中的负数
c = '-55'
print(c.isdigit())
print(c.isnumeric())
# isnumeric()的不同之处是可以判断汉字的数字
d = '四十五八'
print(d.isnumeric())
View Code

ttt

posted on 2020-03-13 16:22  吃我一枪  阅读(388)  评论(0编辑  收藏  举报

导航