title: Ordered os.listdir() in python
body: <p>How to add files into a list by order</p>
  
  <p>In my directory i have the following files: <code>slide1.xml, slide2.xml, slide3.xml ... slide13.xml</code></p>
  
  <p><code>os.listdir(path)</code> doesn't return me a list by order</p>
  
  <p>I've tried this way</p>
  
  <pre><code>files_list = [x for x in sorted(os.listdir(path+"/slides/")) if os.path.isfile(path+"/slides/"+x)]
  </code></pre>
  
  <p>output: <code>['slide1.xml', 'slide10.xml', 'slide11.xml', 'slide12.xml', 'slide13.xml', 'slide2.xml', 'slide3.xml', 'slide3_COPY.xml', 'slide4.xml', 'slide5.xml', 'slide6.xml', 'slide7.xml', 'slide8.xml', 'slide9.xml']</code></p>