>if line[:1] == "1":

This line won't work because you're getting the first 2 characters from the line and seeing if it's equal to a string of length one. For example in your test file if you put this line,
1      12.4    12.0    *   10 ,
through that bit of code it would see if "1 " == "1", which it isn't. As Danny suggested a split should make it easier.
eg:
>>> s = "1      12.4    12.0    *   10"
>>> s.split()
['1', '12.4', '12.0', '*', '10']
>>>
then you could use
if s[0] == "1":
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to