title: Remove Last Path Component In a String
body: <p>I have a path:</p>
  
  <pre><code>myPath = "C:\Users\myFile.txt"
  </code></pre>
  
  <p>I would like to remove the end path so that the string only contains:</p>
  
  <pre><code>"C:\Users"
  </code></pre>
  
  <p>So far I am using split, but it just gives me a list, and im stuck at this point.</p>
  
  <pre><code>myPath = myPath.split(os.sep)
  </code></pre>