[Tutor] substituting empty line with stuff

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Tue Aug 2 23:54:54 CEST 2005

Hello group:

I have a file (3339203 lines) that looks like this:

(col:1)    (col:2)     (col:3)
            XXXXX       XXXXX
            Xaaaa       Xaaaa
            Xbbbb       Xbbbb

            YYYYY       YYYYY
            Yaaaa       Yaaaa

Now I have to fill the rows in column 1 with their
designated stuff:

AD134KL     XXXXX       XXXXX
AD134KL     Xaaaa       Xaaaa
AD134KL     Xbbbb       Xbbbb
AD144KL     YYYYY       YYYYY
AD144KL     Yaaaa       Yaaaa

My code: 

f1 = open('xx','r')
meat = f1.readlines()

mind = []

for i in range(len(meat)):
      if meat[i].startswith('AD'):

mind = [0,4]

for i in range(len(mind)):
      k = i+1
      l = mind[i]+1
      j = mind[k]-1
      print l,j

1 3

Logic: Now I want to substitute 'AD134KL' between 0
and 4 which is 1,2,and 3.  and move on..

After coming to this stage, I lost grip and I do not
know what to do.. 

Can experts help me please. 

thank you

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the Tutor mailing list