title: Use os.listdir to show directories only
body: <p>How can I bring python to only output directories via <code>os.listdir</code>, while specifying which directory to list via <code>raw_input</code>?</p>
  
  <p>What I have:</p>
  
  <pre><code>file_to_search = raw_input("which file to search?\n&gt;")
  
  dirlist=[]
  
  for filename in os.listdir(file_to_search):
      if os.path.isdir(filename) == True:
          dirlist.append(filename)
  
  print dirlist
  </code></pre>
  
  <p>Now this actually works if I input (via <code>raw_input</code>) the current working directory. However, if I put in anything else, the list returns empty. I tried to divide and conquer this problem but individually every code piece works as intended.</p>