help with loops

Catalina Scott A Contr AFCA/EVEO scott.catalina.ctr at scott.af.mil
Mon Mar 6 09:44:36 EST 2006


Hello, 

 

I am not having luck writing code to do what I want and could use a
hand.

 

I have two files and I want to pull out lines from file 2 if certain
conditions are found if file 1.

 

 

for line in readfile1:

    list1 = line.split(',')

        

for line in readfile2:

    list2 = line.split(',')

    

    if list1[3] == list2[6] and list1[4] == list2[8]:

        print line

 

 

This code only compares the last line of readfile1. I want it to check
all lines. But I do not know how to construct the loop.

 

 

 

Thanks in advance,

 

Scott

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060306/dc62f1b8/attachment.html>


More information about the Python-list mailing list