title: Generate output files from template file and csv data in python
body: <p>I need to generate xml files poulated with data from a csv file in python</p>
  
  <p>I have two input files:</p>
  
  <p>one CSV file named data.csv containing data like this:</p>
  
  <pre><code>ID  YEAR    PASS    LOGIN   HEX_LOGIN
  14Z 2013    (3e?k&lt;.P@H}l    hex0914Z    F303935303031345A
  14Z 2014    EAeW+ZM..--r    hex0914Z    F303935303031345A
  .......
  </code></pre>
  
  <p>One Template file named template.xml</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;SecurityProfile xmlns="security_profile_v1"&gt;
  &lt;year&gt;&lt;/year&gt;
  &lt;security&gt;
  &lt;ID&gt;&lt;/ID&gt;
  &lt;login&gt;&lt;/login&gt;
  &lt;hex_login&gt;&lt;/hex_login&gt;
  &lt;pass&gt;&lt;/pass&gt;
  &lt;/security&gt;
  &lt;/SecurityProfile&gt;
  </code></pre>
  
  <p>I want to get as many output files as lines in the csv data file, each output filed named YEAR_ID, with the data from the csv file in the xml fields:</p>
  
  <p>Output files contentes:</p>
  
  <p>Content of output file #1 named 2013_0950014z:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;SecurityProfile xmlns="security_profile_v1"&gt;
  &lt;year&gt;2013&lt;/year&gt;
  &lt;security&gt;
  &lt;ID&gt;14Z&lt;/ID&gt;
  &lt;login&gt;hex0914&lt;/login&gt;
  &lt;hex_login&gt;F303935303031345A&lt;/hex_login&gt;
  &lt;pass&gt;(3e?k&lt;.P@H}l&lt;/pass&gt;
  &lt;/security&gt;
  &lt;/SecurityProfile&gt;
  </code></pre>
  
  <p>Content of output file #2 named 2014_0950014z:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;SecurityProfile xmlns="security_profile_v1"&gt;
  &lt;year&gt;2014&lt;/year&gt;
  &lt;security&gt;
  &lt;ID&gt;14Z&lt;/ID&gt;
  &lt;login&gt;hex0914&lt;/login&gt;
  &lt;hex_login&gt;F303935303031345A&lt;/hex_login&gt;
  &lt;pass&gt;EAeW+ZM..--r&lt;/pass&gt;
  &lt;/security&gt;
  &lt;/SecurityProfile&gt;
  </code></pre>
  
  <p>Thank you for your suggestions.</p>