title: Problems with a python function that return a list of strings?
body: <p>I have a set of files in a directory. So I created a function that apply some processing to all the files in the directory:</p>
  
  <pre><code>def fancy_function(directory, regex):
      for set the path of the directory:
         with open the file names and walk over them:
             preprocessing1 = [....]
             preprocessing2 = [ remove some punctuation from preprocessing1]
  
             return preprocessing2
  </code></pre>
  
  <p>Then I do the following:</p>
  
  <pre><code>list_of_lists = fancy_function(a_directory, a_regex)
  print list_of_lists
  &gt;&gt;&gt;['processed string']
  </code></pre>
  
  <p>It just return one list and the directory actually have 5 files, then when I do the following:</p>
  
  <pre><code>def fancy_function(directory, regex):
      do preprocessing...
      preprocessing1 = [....]
      preprocessing2 = [ remove some punctuation from preprocessing1]
      print preprocessing2
  </code></pre>
  
  <p>print fancy_function(a_directory, a_regex)</p>
  
  <p>It returns the 5 preprocessed files that I want like this:</p>
  
  <pre><code>['file one']
  ['file two']
  ['file three']
  ['file four']
  ['file five']
  </code></pre>
  
  <p>Why is this happening and how can I obtain the 5 files in a list?. I would like to save them In one list in order to make a nother processing but now for each list in the main list, something like this:</p>
  
  <pre><code>main_list =[['file one'], ['file two'], ['file three'], ['file four'], ['file five']]
  </code></pre>