looping through two list simultenously

Paul McGuire ptmcg at austin.rr._bogus_.com
Sun Oct 29 23:31:45 EST 2006


"CSUIDL PROGRAMMEr" <syedamjad_a at yahoo.com> wrote in message 
news:1162153701.052043.160030 at h48g2000cwc.googlegroups.com...
> folks
> I have two lists
>
> i am trying to loop thorough them simultenously.
>
> Here is the code i am using
>
> f1 = os.popen('ls  chatlog*.out')
> data1=f1.readlines()
> f1.close()
>
> data1=[x.strip() for x in data1]
> f1 = os.popen('ls  chatlog*.txt')
> data=f1.readlines()
> f1.close()
> for eachline in data1 and line in data:

Change:
for eachline in data1 and line in data:

to:
for eachline, line in zip(data1,data):


-- Paul 





More information about the Python-list mailing list