title: Run a Python Script for all the files in a directory
body: <p>My programming skills are very(x10) limited.
  But I have this little python script:</p>
  
  <pre><code>#load data
  files = '/Users/xxx/Desktop/Test_SP/a.txt'
  file = open(files, 'rt')
  text = file.read()
  file.close()
  # split into words
  from nltk.tokenize import word_tokenize
  tokens = word_tokenize(text)
  # stemming of words
  from nltk.stem.porter import PorterStemmer
  porter = PorterStemmer()
  stemmed = [porter.stem(word) for word in tokens]
  print(stemmed[:20])
  </code></pre>
  
  <p>Can someone please tell me how to run this script for <strong>ALL the files in this directory</strong> (<code>/Users/xxx/Desktop/Test_SP</code>) and not only for 1 File at a time (<code>a.txt</code>)</p>
  
  <p><em>(I already know about glob, <code>os.walk</code> etc. but I couldn't manage to make it work. Every help is very appreciated.)</em></p>