4.03553833007813E+002 3.52176117897034E+000 -3.47368684507223E+002 3.52219986915588E+000
I have a file with 360 Lines with 4 Numbers as above. I can read a line to a string, but howto convert the numbers to floats? In C++ this would be easy with strstream, but i am a newby in phyton.
Would you help me?
An example for 3 numbers http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_pythonraw2mesh.htm not so hard to modify to work with 4 .
float(“3.141592654”)
or
int(“2”)
str(3.141592654)
as for reading them from the file, I’ll leave that till I wake up or somone else answers
y = "4.03553833007813E+002 3.52176117897034E+000 -3.47368684507223E+002 3.52219986915588E+000" [float(x) for x in y.split()]