def check_float_integer(s): #判断价格正确的正整数或正小数 s = str(s) if check_integer(s) == True: return True elif s.count('.') == 1: s_split = s.split('.') left,right = s_split if left.isdigit() and right.isdigit(): if int(right) > 0: #整数部分大于0 return True return False def check_integer(s): #判断数量是正整数 s = str(s) if s.isdigit(): #判断是否是大于等于0的整数 if int(s) > 0: return True return False