On 29/01/2014 14:50, Gabriele Brambilla wrote:
thanks to everyone, I've used David's method.

Gabriele

2014-01-29 Mark Lawrence <[email protected]
<mailto:[email protected]>>

    On 29/01/2014 02:09, Gabriele Brambilla wrote:

        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


    Something like this, untested:-

    floats = []
    with open('myfile') as infile:
         for line in infile:
             floats.extend(float(f) for f in line.split())

    --
    My fellow Pythonistas, ask not what our language can do for you, ask
    what you can do for our language.

    Mark Lawrence


Please don't top post.

FTR what is David's method and who is David?

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to