title: how to use os.popen, os.path.join for command line ls in python
body: <p>I have the following directories and subdirectories with txfiles in it. I want to access them for reading the lines. But this does not work. can you help me out here?</p>
  
  <p>main directory: 2009</p>
  
  <p>sub directory: movies, albums, songs</p>
  
  <p>each of these directory contains text files.
  I want to read through each lines of these text files</p>
  
  <p>my pseudocode is as folllows </p>
  
  <pre><code>x = os.listdir("2009")
  </code></pre>
  
  <p>Now, x will be a list of [movies, albums, songs]</p>
  
  <pre><code>for el in x:
    os.system("ls 2009/el")
    for lines in os.popen(2009/el"):
         print lines
  </code></pre>