Brian van den Broek wrote:
jrlen balane said unto the world upon 2005-02-17 02:41:
[...]
data_file = open('C:/Documents and Settings/nyer/Desktop/nyer.txt', 'r')
[...]
The immediate one, due to my advice, is that each line of your file ends with a newline character ('\n'). So, you cannot call int on '1000\n'.

Try
data_points.append(int(line[:-1]))
instead. That will call int on line minus the last character (the newline).
The OS is from MS, so the lines will probably end with '\r\n'. It is better to call strip() on each line:
data_points.append(int(line.strip()))


HTH,
Wolfram

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to