[EMAIL PROTECTED] wrote:

what about :

factors = [map(float, line.split()) for line in file]

should be a hell of a lot faster and nicer.

             for line in f:
                 factor = []
                 tokens = line.split()
                 for i in tokens:
                     factor.append(float(i))
                 factors.append(factor)

Is this nasty?

Jim


Oh the relief :)

Of course, line.split() is already a list.

Couple of seconds for the 10000 line file.

Thanks.

What I really want is a Numeric array but I don't think Numeric supports importing files.

Jim
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to