title: Python: create a dictionary with elements consist of file, path and the content
body: <p>The issue I'm facing is that I have to find each file that ends in ".txt" and read it's content to return a dictionary. </p>
  
  <p><strong>Returned dictionary should looks like this:</strong></p>
  
  <pre><code>dic = { 'Folder\\\fileName.txt' : "This is content" }
  </code></pre>
  
  <p>So far I have: </p>
  
  <pre><code>directory = os.path.join("C:/Users/John/Desktop/Ppractice") 
  rootdir = directory.rstrip(os.sep)    
  for path, dirs, files in os.walk(rootdir):  
      folders = path[start:].split(os.sep)
      for file in files: 
          if file.endswith(".txt"): 
              f=open(os.path.join(subdir, file),'r')  
              a = f.read()  
              parent = reduce(dict.get, folders[:-1], dir)
              print dir 
  </code></pre>
  
  <p>when I run the program I get <code>None</code> </p>