Re: looping through two list simultenously

2006-10-29 Thread Paul McGuire
"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

Re: looping through two list simultenously

2006-10-29 Thread jim-on-linux
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

Re: looping through two list simultenously

2006-10-29 Thread [EMAIL PROTECTED]
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

Re: looping through two list simultenously

2006-10-29 Thread Daniel Nogradi
> 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

Re: looping through two list simultenously

2006-10-29 Thread Michael S
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

Re: looping through two list simultenously

2006-10-29 Thread Björn Lindström
"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]>

looping through two list simultenously

2006-10-29 Thread CSUIDL PROGRAMMEr
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