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

前端 未结 18 2229
甜味超标
甜味超标 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:58

    your answer is throwing errors because of this line

    readings = int(readings)
    
    1. Here you are trying to convert a string into int type which is not base-10. you can convert a string into int only if it is base-10 otherwise it will throw ValueError, stating invalid literal for int() with base 10.

提交回复
热议问题