title: Python - Converting XML to CSV
body: <p>Good Afternoon All.</p>
  
  <p>I will preface this question by saying that this is my first foray into Python.  I am using an API to return the following XML sample:</p>
  
  <pre><code>&lt;Times&gt;
      &lt;Time&gt;
          &lt;ID&gt; 120877787 &lt;/ID&gt;
          &lt;Job&gt;
              &lt;ID&gt; J000050 &lt;/ID&gt;
              &lt;Name&gt; My Job &lt;/Name&gt;
          &lt;/Job&gt;
          &lt;Task&gt;
              &lt;ID&gt; 59469972 &lt;/ID&gt;
              &lt;Name&gt; My Task &lt;/Name&gt;
          &lt;/Task&gt;
          &lt;Staff&gt;
              &lt;ID&gt; 74268 &lt;/ID&gt;
              &lt;Name&gt; My Name &lt;/Name&gt;
          &lt;/Staff&gt;
          &lt;Date&gt; 2017-05-19T00:00:00 &lt;/Date&gt;
          &lt;Minutes&gt; 480 &lt;/Minutes&gt;
          &lt;Note/&gt;
          &lt;Billable&gt; true &lt;/Billable&gt;
      &lt;/Time&gt;
  &lt;/Times&gt;
  </code></pre>
  
  <p>I am presently in the process of converting the XML to CSV using Python 3.4.</p>
  
  <p>I have done a fair bit of research (<a href="http://blog.appliedinformaticsinc.com/how-to-parse-and-convert-xml-to-csv-using-python/" rel="nofollow noreferrer">http://blog.appliedinformaticsinc.com/how-to-parse-and-convert-xml-to-csv-using-python/</a> for example) into resolving the issue, but I can't come up with a suitable result, primarily because I don't understand the syntax well enough to adapt it to my exact circumstance.</p>
  
  <p>Basically I am looking for the following output.</p>
  
  <pre><code>Job Name  Task Name  Staff Name  Date                 Minutes Billable
  My Job    My Task    My Name     2017-05-19T00:00:00  480     true
  </code></pre>
  
  <p>As requested this is how the XML is returned from the API (as a string and viewed by print(ts.content)), which may be where I am going wrong. </p>
  
  <pre><code>&lt;Times&gt;&lt;Time&gt;&lt;ID&gt; 120877787 &lt;/ID&gt;&lt;Job&gt;&lt;ID&gt; J000050 &lt;/ID&gt;&lt;Name&gt; My Job &lt;/Name&gt;&lt;/Job&gt;&lt;Task&gt;&lt;ID&gt; 59469972 &lt;/ID&gt;&lt;Name&gt; My Task &lt;/Name&gt;&lt;/Task&gt;&lt;Staff&gt;&lt;ID&gt;74268&lt;/ID&gt;&lt;Name&gt; My Name &lt;/Name&gt;&lt;/Staff&gt;&lt;Date&gt; 2017-05-19T00:00:00 &lt;/Date&gt;&lt;Minutes&gt; 480 &lt;/Minutes&gt;&lt;Note/&gt;&lt;Billable&gt; true &lt;/Billable&gt;&lt;/Time&gt;&lt;/Times&gt;
  </code></pre>
  
  <p>Could someone please offer some insight into the best way to approach this task?</p>
  
  <p>Thank you for your help.</p>
  
  <p>Scott</p>