title: how to re-arrange 3 for loops in a script to be just one
body: <p>I have this script that contains four different function. Function 2-4 have a common path, the for loop. I would like to get some help so I can sort that 'for loop' making it into one but depending on the function to get the data from the right file, fastqs, faster or xml.</p>
  
  <pre><code>&gt; def One(): #gene extraction
      #do something
  One()
  
  def Two(path_to_folder_H*,something_else): # de novo assembly
      #do something with files
  
  folders=glob.glob(path_to_folder_H*)
  for folder in folders:
      my_file=glob.glob(file.fastqs)
      if folder exit:
         #do something
      elif:
          # do something else
     Two(path_to_folder_H*,something_else)
  
  def Third(path_to_folder_H*, someting_else_2): #database+blast
      #do something
  
  folders=glob.glob(path_to_folder_H*)
  for folder in folders:
      my_file=glob.glob(file.fa)
      Third(path_to_folder_H*,something_else_2)
  
  def Fouth(path_to_folder_H*,something_else_3): #parsing file
      #do someething
  count=0
  dict={}
  folders=glob.glob(path_to_folder_H*)
  for folder in folders:
      my_file=glob.glob(file.xml)
      if something:
             #do something
      elif:
     #something else
      Fourth(path_to_folder_H*,something_else_3)
  </code></pre>
  
  <p>This code is about 200 line long, and I just put a synopsis to abbreviate. The first function extract data from a file. The second function does the <em>novo assembly</em>  with the fastqs file, and give a confing.fa. The third function uses the cotings.fa and a file obtained with the first function to do a database, and blast, giving an xml file. The fourth function parse the xml obtained with the third funcion.</p>