title: How to read a folder name and output result to a string
body: <p>I have some code for reading directory names and file names</p>
  
  <pre><code>import os
  
  #define the folder you want to use
  myfolder = path/to/directory
  
  #read directories
  for dirs in os.walk(myfolder):        
      for dir in dirs:
          print("Directory name = %s" %dir
  </code></pre>
  
  <p>lets say inside -myfolder- I have a directory called -mysecondfolder-</p>
  
  <p>is it possible to output the filename to a string</p>
  
  <p>something like </p>
  
  <pre><code>for dirs in os.walk(myfolder):
      for dir in dirs:
          targetfolder="%dir"
  </code></pre>