[Tutor] Please help

Srinivas Iyyer srini_iyyer_bio at yahoo.com
Wed Aug 3 15:38:58 CEST 2005

sorry for repost.

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 getting the idexes of blank rows between two AD*
as a list, I lost grip and I cannot think of what
should be done next

Is this a good way to solve it . or is there any other
easy way

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