title: Storing a list of data from multiple files in array
body: <p>Alright what i am doing is taking the contents of ONE .log file ONLY, storing it in an array, then outputting it in a multiple listbox as follows:</p>
  
  <pre><code>filelog_ext=".log" #log extension
  
  #open one log file
  f = open("%s\%s%s" % (path,filename,filelog_ext),"r")
  #init aray      
  array = []
  #copy contents of file to array
  for line in f:
      array.append( line )
  f.close()
  #insert each array content to multilistbox
  self.mlb.insert (END, ('%s' % (array[0]),'%s' % (array[1]),'%s' % (array[2]),'%s' % array[3])))
      self.mlb.pack (expand=YES,fill=BOTH)
  </code></pre>
  
  <p>what i want to do now is taking contents of MANY .log files, outputting them in arrays and then outputting them in a multiple listbox.</p>
  
  <p>I have tried the following but it does not seem to work:</p>
  
  <pre><code>for files in os.listdir("."):        
          if files.endswith(".log"):  #this will take all my files ending with .log
  
      #not sure how to go about and take all files ending with .log, copying them to array and saving them to the multilistbox mlb
  </code></pre>
  
  <p>Can anyone please help me ?</p>
  
  <p>UPDATE:
  @john zwink
  i have tried to integrate your code don't know if im doing it the right way but it still doesnt work. Error is "Index list out of range"</p>
  
  <pre><code>    path = "C:\sdmdownloads"        
      array = []
      for filename in glob.iglob(os.path.join(path, filelog_ext)):
         with open(filename) as f:
             array.extend(f)
             self.mlb.insert (END, ('%s' % (array[0]),'%s' % (array[1]),'%s' % (array[2]),'%s' % (array[3])))
             self.mlb.pack (expand=YES,fill=BOTH)
  </code></pre>