a=input("请输入数字")
def isnum(a):
try:
n=eval(a)
if type(n)==float or type(n)==int or type(n)==complex:
print('True')
else:
prit('False')
except:
print('False')
isnum(a)
python 实现isnum()函数,参数为一个字符串,如果这个字符串属于整数,浮点数,复数,返回TURE,否则返回False
最新推荐文章于 2024-04-20 16:29:09 发布