[Tutor] Fwd: reading files

David Palao dpalao.python at gmail.com
Wed Jan 29 23:55:37 CET 2014


...that I forgot to send to the mailing list...


---------- Forwarded message ----------
From: David Palao <dpalao.python at gmail.com>
Date: 2014-01-29
Subject: Re: [Tutor] reading files
To: Gabriele Brambilla <gb.gabrielebrambilla at gmail.com>


Hi,
One possibility I can think of: If you make one string with one line
of your input, like
s = "1.05519999999995        1.26758123387023
-0.314470329249235 -0.293015360064208      6.15795761907822
1.92919102133526 13.0780459630378        2.15175351758512e6"
then
L = [float(i) for i in s.split()]
is a list of the floats you are looking for.

Best.

2014-01-29 Gabriele Brambilla <gb.gabrielebrambilla at gmail.com>:
> Hi,
> how could I read float numbers if the data format is like this (using
> readline):
>
> 1.05519999999995        1.26758123387023        -0.314470329249235
> -0.293015360064208      6.15795761907822        1.92919102133526
> 13.0780459630378        2.15175351758512e6
>
> the numbers aren't equally spaced and they had not the same number of
> figures...
>
> thanks
>
> Gabriele
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list