0

Im having some problem with a list of ints, it looks like this:

enter image description here

Its part of a bigger list, but when I try to go thru it line by line and parse it I get the following error:

ValueError: invalid literal for int() with base 10: '\xef\xbb\xbf85\n'

My code looks like:

with open("data.csv", "r") as ins:

    array = []

    for line in ins:
        print 'String: ', line

        print 'Integer: ', int(line)

If I try to catch the error with this code:

with open("data.csv", "r") as ins:

    array = []

    for line in ins:
        print 'String: ', line

        try:
            print 'Integer: ', int(line)
        except:
            print 'Non-integer: ', line

I get this output:

enter image description here

Anyone have a clue?

Jason94
  • 13,320
  • 37
  • 106
  • 184

0 Answers0