I am processing a text file with 6400 numbers separated by a comma in an 80 x 80 matrix, however I am getting an;
invalid literal for int() with base 10: ''
What's strange is that this code works on windows but not mac (same python version)
I've tried checking for extra spaces and commas by using try and except to no avail
def read_numbers(file):
with open(file) as f:
text = f.read()
text = text.replace("\n", ",")
numbers = []
for s in text.split(','):
try:
numbers.append(int(s))
except ValueError, e:
print "error",e, "with", "(",s,")"
return numbers