title: Python sort() function not sorting how I expect
body: <p>I'm very new to python and can't figure out how to get the .sort() function to work.</p>
  
  <p>I have a folder of .txt files on my computer that I am trying to order by file name. They are titled poem_1.txt through poem_600.txt. so far, this is what I have:</p>
  
  <pre><code>   import os
      all_poems=[]
      for root, dirs, files in os.walk(mydir):
          for file in files:
              if file.endswith(".txt"):
                  all_poems.append(os.path.join(root, file))
      n_files = len(all_poems)
  </code></pre>
  
  <p>and then i can verify that all 600 files have been looped and appended by using</p>
  
  <pre><code>all_poems[600]
  </code></pre>
  
  <p>then, i do</p>
  
  <pre><code> all_poems.sort()
  </code></pre>
  
  <p>and it gives me the poems in this order:</p>
  
  <pre><code>'poem_1.txt', 'poem_10.txt', 'poem_100.txt', 'poem_11.txt', 'poem_12.txt', 'poem_13.txt', 'poem_14.txt', 'poem_15.txt', 'poem_16.txt', 'poem_17.txt', 'poem_18.txt', 'poem_19.txt', 'poem_2.txt', 'poem_20.txt', 'poem_21.txt'
  </code></pre>
  
  <p>what am I doing wrong?</p>