title: Unused object while using os.walk
body: <p>I have the code below to list all the files in directory and subdirectory.</p>
  
  <pre><code>def GetListFiles(rootdir,fileextension):
      import os
      testfiles = []
      for root,subfolders,files in os.walk(rootdir):
          for file in files:
              ext = "." + fileextension
              if (os.path.splitext(file)[-1].lower()==ext) and (file!="AssemblyInfo.cs"):
                  testfiles.append(os.path.join(root,file))
      return testfiles
  </code></pre>
  
  <p>In the line <code>for root,subfolders,files in os.walk(rootdir):</code>, the variable, <code>subfolders</code>is not used. If I remove it, it is error </p>
  
  <blockquote>
    <p>"too many values to unpack (expected 2)"</p>
  </blockquote>
  
  <p>How can I avoid this?</p>