writing data to an xml file from a list
<p>I am trying to write data in a list to an xml file using the following code,i have the expected output on how the data should be present in data.xml file...running into a compilation error,can anyone provide inputs on what is wrong here?</p>

<pre><code>data = [['SEC.12.0', '\\\\DATA\\LOC', '\\\\ftp\\location'], ['SEC.13.0', '\\\\DATA\\LOC2', '\\\\ftp\\location2']]


for set in data :
    f = open('data.xml', 'w')
    f.write(&lt;pro&gt;set[0]&lt;/pro&gt;)
    f.write(&lt;dataloc&gt;set[1]&lt;/dataloc&gt;)
    f.write(&lt;ftploc&gt;set[2]&lt;/ftploc&gt;)
</code></pre>

<p>error:-</p>

<pre><code>  File "test.py", line 8
    f.write(&lt;pro&gt;set[0]&lt;/pro&gt;)
            ^
SyntaxError: invalid syntax
</code></pre>

<p>EXPECTED OUTPUT:-</p>

<pre><code>data.xml file should contain the follwing

        &lt;pro&gt;SEC.12.0&lt;/pro&gt;
        &lt;dataloc&gt;\\DATA\LOC&lt;/dataloc&gt;
        &lt;ftploc&gt;\\ftp\location&lt;/ftploc&gt;
        &lt;pro&gt;SEC.13.0&lt;/pro&gt;
        &lt;dataloc&gt;\\DATA\LOC2&lt;/dataloc&gt;
        &lt;ftploc&gt;\\ftp\location2&lt;/ftploc&gt;
</code></pre>
