python 判断变量类型

a='weihongrao'

if not isinstance(a,float):
    print('not')
else:
    print('yes')


if not isinstance(a,(float,int)):
    print(a+' is not type eror')

你可能感兴趣的:(python)