ValueError: invalid literal for int() with base 10: ''

前端 未结 18 1913
甜味超标
甜味超标 2020-11-22 02:06

I am creating a program that reads a file and if the first line of the file is not blank, it reads the next four lines. Calculations are performed on those lines and then t

18条回答
  •  臣服心动
    2020-11-22 02:54

    Just for the record:

    >>> int('55063.000000')
    Traceback (most recent call last):
      File "", line 1, in 
    ValueError: invalid literal for int() with base 10: '55063.000000'
    

    Got me here...

    >>> int(float('55063.000000'))
    55063.0
    

    Has to be used!

提交回复
热议问题