splitting up lines of a file using python

I have a file containing:

   0.0000  6 G01 G03 G04 G11 G28 G32
42.750    38.750    44.250    36.000    39.000    42.750

I am trying to split up the 2nd and 3rd line so that i have a list of:

(0.0000, 6, G01, G03, G04, G11, G28, G32) for the 2nd line and,

(42.750, 38.750, 44.250, 36.000, 39.000, 42.750) for the 3rd line.

so far I have:

for line in file:
    if ('G') in line:
        sats = line.split("/t")  
    elif ('-1') in line:
        epoch = line.split("/t")

However they are not being split up properly and all that i get is:

sats= ['   0.0000  6 G01 G03 G04 G11 G28 G32\n'  ]
epoch= ['     1.0000 -1\n']

Can anybody help?

Upvotes: 0

Views: 51

Answers (1)

cromod
cromod

Reputation: 1799

Try to replace split("/t") by split().

Upvotes: 2

Related Questions