title: Python For loop to extract array slow
body: <p>I have the following situation.</p>
  <p><strong>getValues()</strong> <em>Get selenium data and add it to a variable</em></p>
  <p><strong>transValues()</strong> <em>Takes the variable data and makes a simpler array. Because in the variable &quot;temp&quot; there is a .text object</em></p>
  <p><strong>comparValues()</strong> <em>Checks if the variables are the same, if not shows the index.</em></p>
  <p><strong>The functions run in 3 different threads simultaneously.</strong></p>
  <pre><code>def getValues():
      global names, temp
      while True:
          try:
              names = driver.find_elements(By.CLASS_NAME, &quot;lobby-table__name-container&quot;)
              temp = driver.find_elements(By.CLASS_NAME, &quot;roulette-history-item__value-textsiwxWvFlm3ohr_UMS23f&quot;)
              time.sleep(3)
              vold = driver.find_elements(By.CLASS_NAME, &quot;roulette-history-item__value-textsiwxWvFlm3ohr_UMS23f&quot;)
          except:
              pass
  
  def transValues():
      global vatual
      while True:
          try:
              vatual = [x.text for x in temp]
              console_print(vatual[0])
          except:
              console_print(&quot;Erro ao transformar valores... persist&quot;)
              pass
  
  def comparValues():
      try:
          out = [i for i,(e1,e2) in enumerate(zip(vatual,b)) if e1!=e2] or False
          if len(out) &gt; 0:
              print(out)
      except:
          pass
  </code></pre>
  <p>The code is so slow:</p>
  <pre><code>vatual = [x.text for x in temp]
  </code></pre>
  <p>Is there another way to do this? temp have 300 keys, this loop takes 3 seconds</p>
  <p>Thanks for replying</p>