title: os.path.dirname() and os.path.basemane() are giving weird results
body: <p>I have recently read about <code>dirname</code> and <code>basename</code>. My book uses the following image to explain the difference between them:</p>
  
  <p><a href="https://i.stack.imgur.com/w0mtV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w0mtV.png" alt="enter image description here"></a></p>
  
  <p>I am currently using OSX so my root folder will be /. I wrote the following code in my shell:</p>
  
  <pre><code>path='\\Users\\apple\\Documents\\list.txt'
  os.path.dirname(path) 
  </code></pre>
  
  <p>The result that I got was: <code>''</code> </p>
  
  <p>Then I wrote the following code to check the basename:
  <code>os.path.basename(path)</code> and the result that I got this time was: <code>'\\Users\\apple\\Documents\\list.txt</code>! </p>
  
  <p>Whats happening over here? How to fix it?</p>
  
  <p>Also, I don't have any text file whose name is <em>list</em>. Shouldn't this cause an error when I was trying to find the <code>dirname</code> and <code>basename</code> of a file that does not exist!?</p>