sorry for repost. Hello group:
I have a file (3339203 lines) that looks like this: (col:1) (col:2) (col:3) AD134KL XXXXX XXXXX Xaaaa Xaaaa Xbbbb Xbbbb AD144KL YYYYY YYYYY Yaaaa Yaaaa Now I have to fill the rows in column 1 with their designated stuff: AD134KL AD134KL XXXXX XXXXX AD134KL Xaaaa Xaaaa AD134KL Xbbbb Xbbbb AD144KL 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.append(i) 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 srini __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor