[newbie] problem with data (different behaviour between batch and interactive use)

Jean Dupont jeandupont115 at gmail.com
Wed Jun 27 08:24:42 EDT 2012


I have some data which is presented in the following format to me:
+3.874693E-01,+9.999889E-03,+9.910000E+37,+1.876595E+04,+3.994000E+04
I'm only interested in the first two fields i.e.
+3.874693E-01,+9.999889E-03
If I start python interactively I can separate the fields as follows:
>measurement=+3.874693E01,+9.999889E03,+9.910000E+37,+1.876595E+04,+3.994000E+04
>print measurement[0]
0.3874693
>print measurement[1]
0.009999889
If however I run a script with the same commands I get something different:
The script does this:
measurement=serkeith.readline().replace('\x11','').replace('\x13','').replace('\x0d','\n')
print measurement[0]
+
print measurement[1]
3

can anyone here tell me what I'm doing wrong and how to do it correctly

thanks
jean



More information about the Python-list mailing list