title: How to split a dos path into its components in Python
body: <p>I have a string variable which represents a dos path e.g:</p>
  
  <p><code>var = "d:\stuff\morestuff\furtherdown\THEFILE.txt"</code></p>
  
  <p>I want to split this string into:</p>
  
  <p><code>[ "d", "stuff", "morestuff", "furtherdown", "THEFILE.txt" ]</code></p>
  
  <p>I have tried using <code>split()</code> and <code>replace()</code> but they either only process the first backslash or they insert hex numbers into the string.</p>
  
  <p>I need to convert this string variable into a raw string somehow so that I can parse it.</p>
  
  <p>What's the best way to do this?</p>
  
  <p>I should also add that the contents of <code>var</code> i.e. the path that I'm trying to parse, is actually the return value of a command line query. It's not path data that I generate myself. Its stored in a file, and the command line tool is not going to escape the backslashes.</p>