title: Handling spaces inside path variable python
body: <p>I have a string as follows </p>
  
  <p><code>command= "copy1 "D:\path1\program Files" "c:\program Files\path1" copy2 "D:\path2\program Files" "c:\program Files\path2""</code></p>
  
  <p>Note that both copy1 and copy2 are inside the string. My intention was to write each copy process insde an xml file as follows:</p>
  
  <pre><code>        &lt;copyFiles&gt;
                 &lt;copy1&gt;
                      &lt;Sourcepath&gt;D:\path1\program Files&lt;/Sourcepath&gt;
                      &lt;DestPath&gt;c:\program Files\path1&lt;/DestPath&gt;
                  &lt;/copy1&gt;
  
                   &lt;copy2&gt;
                      &lt;Sourcepath&gt;D:\path2\program Files&lt;/Sourcepath&gt;
                      &lt;DestPath&gt;c:\program Files\path2&lt;/DestPath&gt;
                    &lt;/copy2&gt;
  
           &lt;copyFiles&gt;
  </code></pre>
  
  <p>I tried to create a list of each paramter by splitting the string using spaces as follows: </p>
  
  <p><code>Copyparamlist=command.split(' ')</code></p>
  
  <p>But I am geeting the xml as follows: </p>
  
  <pre><code>        &lt;copyFiles&gt;
                 &lt;copy1&gt;
                      &lt;Sourcepath&gt;D:\path1\program&lt;/Sourcepath&gt;
                      &lt;DestPath&gt;c:\program&lt;/DestPath&gt;
                  &lt;/copy1&gt;
  
                   &lt;copy2&gt;
                      &lt;Sourcepath&gt;D:\path2\program&lt;/Sourcepath&gt;
                      &lt;DestPath&gt;c:\program&lt;/DestPath&gt;
                    &lt;/copy2&gt;
  
           &lt;copyFiles&gt;
  </code></pre>
  
  <p>The contents of my list should be as follows: 
  <code>["copy1", "D:\path1\program Files", "c:\program Files\path1", "copy2",
   "D:\path2\program Files]", "c:\program Files\path2"]</code></p>
  
  <p>Please help</p>