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

前端 未结 18 2230
甜味超标
甜味超标 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 03:05

    I had hard time figuring out the actual reason, it happens when we dont read properly from file. you need to open file and read with readlines() method as below:

    with open('/content/drive/pre-processed-users1.1.tsv') as f:
        file=f.readlines()
    

    It corrects the formatted output

提交回复
热议问题