"CSUIDL PROGRAMMEr" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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 da
On Sunday 29 October 2006 15:28, CSUIDL PROGRAMMEr
wrote:
> folks
> I have two lists
>
> i am trying to loop thorough them
> simultenously.
>
Try something like this.
for eachline in data1:
print eachline
for line in data::
print line
You might also think about a while loop
CSUIDL PROGRAMMEr wrote:
> 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')
You can replace this by
py> import glob
py> f1 = glob.glob('chatlog*.out')
it will return a list of filenames in f1, so yo
> folks
> I have two lists
>
> i am trying to loop thorough them simultenously.
>
> Here is the code i am using
[...]
> Is there any efficient doing this
>
Try the zip function:
>>> list1 = [ 'a', 'b', 'c' ]
>>> list2 = [ 'A', 'B', 'C' ]
>>> for i, j in zip( list1, list2 ):
... print i, j
What if you do it in 2 separate threads?
--- CSUIDL PROGRAMMEr <[EMAIL PROTECTED]> wrote:
> 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.str
"CSUIDL PROGRAMMEr" <[EMAIL PROTECTED]>:
> folks I have two lists
>
> i am trying to loop thorough them simultenously.
>
> Is there any efficient doing this
Try the built-in function zip.
>>> zip(['a', 'b', 'c'], [1, 2, 3])
[('a', 1), ('b', 2), ('c', 3)]
--
Björn Lindström <[EMAIL PROTECTED]>
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