You could also use the csv module
import csv
myfileobj = open("myfiletab.txt","read")
csv_read = csv.reader(myfileobj,dialect=csv.excel_tab)
myval1 = []
myval2 = []
myval3 = []
for line in csv_read:
# filter header and stuff using some criterion
if len(line) = 3:
myval1.append(line[0])
time_vec, ch1_vec, and_so_on = zip(*(
map(float, line.split())
for line in file('in.txt')))
If this isn't homework, there are some less terse versions which
are a bit easier on the eyes and less like some love-child
between Perl and Python.
haha, no this isn't homework. I'm a mecha
Stephen wrote:
> Hi,
>
> I would like to read a text file of numbers produced by a data
> acquisition system into three vectors of doubles. The contents of the
> file are:
>
> +0.000e+0 +2.7645134e+1 +2.7745625e+1
>
> +0.4100041e-1 +2.7637787e+1 +2.7731047e+1
>
> +0.0820008e+0 +2.76451
On Feb 23, 4:06 pm, Tim Chase wrote:
> > I would like to read a text file of numbers produced by a data
> > acquisition system into three vectors of doubles. The contents of the
> > file are:
>
> > +0.000e+0 +2.7645134e+1 +2.7745625e+1
> > +0.4100041e-1 +2.7637787e+1 +2.7731047e+
I would like to read a text file of numbers produced by a data
acquisition system into three vectors of doubles. The contents of the
file are:
+0.000e+0 +2.7645134e+1 +2.7745625e+1
+0.4100041e-1 +2.7637787e+1 +2.7731047e+1
+0.0820008e+0 +2.7645134e+1 +2.7750483e+1
...
or
+0.
Hi,
I would like to read a text file of numbers produced by a data
acquisition system into three vectors of doubles. The contents of the
file are:
+0.000e+0 +2.7645134e+1 +2.7745625e+1
+0.4100041e-1 +2.7637787e+1 +2.7731047e+1
+0.0820008e+0 +2.7645134e+1 +2.7750483e+1
...
or
+