title: How to control order of result from iterator in python
body: <p>I use <code>pathlib.Path().iterdir()</code> to get sub-dictionary of the path.</p>
  <p>Under <code>/home/yuanyi/workspace/app</code>, there are 4 folders: <code>01</code>, <code>02</code>, <code>03</code>, <code>04</code>.</p>
  <pre><code>from pathlib import Path
  for subdir in Path('/home/yuanyi/workspace/app').iterdir():
      print(subdir)
  </code></pre>
  <p>But the result is not ordered.</p>
  <pre><code>/home/yuanyi/workspace/app/02
  /home/yuanyi/workspace/app/03
  /home/yuanyi/workspace/app/01
  /home/yuanyi/workspace/app/00
  </code></pre>
  <p>Wht the result is not the following:</p>
  <pre><code>/home/yuanyi/workspace/app/01
  /home/yuanyi/workspace/app/02
  /home/yuanyi/workspace/app/03
  /home/yuanyi/workspace/app/04
  </code></pre>
  <p>I want to know how the iterator works, and what's the best method to get ordered result.</p>