title: Python: How to check if path is a subpath
body: <p>Lets say I have these paths:</p>
  
  <pre><code>/tmp/a
  /tmp/abc
  /tmp/abc/d/my_file.py
  </code></pre>
  
  <p>How could I check if <code>/tmp/abc/d/my_file.py</code> is a subpath of <code>/tmp/abc</code>? I tried:</p>
  
  <pre><code>file_path.startswith(dir_path)
  </code></pre>
  
  <p>But it returns <code>True</code> for <code>/tmp/a</code> directory, while <code>my_file.py</code> is not in it.</p>