looping through two list simultenously
CSUIDL PROGRAMMEr
syedamjad_a at yahoo.com
Sun Oct 29 15:28:21 EST 2006
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:
filename='/root/Desktop/project/'+ eachline
print filename
outfile=open(filename,'r')
filename1='/root/Desktop/project/' + line
print filename1
I get the error that line is not defined.
Traceback (most recent call last):
File "list.py", line 16, in ?
for eachline in data1 and line in data:
NameError: name 'line' is not defined
Is there any efficient doing this
More information about the Python-list
mailing list