title: Python read filenames and save in list
body: <p>I need to read all files in a directory and save into list, then read list those files one by one.
  I don't want to use external module like 'glob module'. So, trying through 2 different approach:</p>
  
  <p><strong>First approach:</strong> </p>
  
  <pre><code>import os 
  file_list = os.listdir("jsons")
  
  for files in file_list:
      data = open(files,"r")
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>  ['A03DUrQz1BM9SQ2.json', 'A04D5V1u1BMxaV6.json', 'A0kxiHL81AN9pH5.json', 'A1Fxs5Ag1A8vuB5.json', 'A2Dsv7RE1BDqYt5.json', 'A2HkZPkn1BpvvG5.json']
  </code></pre>
  
  <p>but here issue is that filenames are saved in string format and not able to open this file as it read it with quotes ''.</p>
  
  <p><strong>2nd approach:</strong></p>
  
  <pre><code>file_list = os.system("ls jsons/")
  **print file_list.split()**
  for files in file_list:
      data = open(files,"r")
      print data 
  </code></pre>
  
  <p>output: </p>
  
  <pre><code>Traceback (most recent call last):
    File "asn-1_q3.py", line 9, in &lt;module&gt;
      print file_list.split()
  AttributeError: 'int' object has no attribute 'split'
  </code></pre>
  
  <p>Here, it is saving as int and not able to split the file. 
  How should I solve them ?</p>