'''
1、判断小数点个数是不是1  count
2、分割,判断小数点右边是不是整数
3、判断小数点左边 1、是整数is_digit
                          2、如果是负整数,按照'-'符号右边的是不会整数
'''                                
def is_float(s):
    s = str(s)
    if s.count('.') ==1:
        left = s.split('.')[0]
        right = s.split('.')[1]
        if right.isdigit():
            if left.count('-')==1 and left.startswith('-'):
                num = left.split['-'][-1]
                if num.isdigit():
                    return True
            elif left.isdigit():
                return Ture
    return False

  

相关文章:

  • 2021-11-23
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
相关资源
相似解决方案