Python: Rewrite a Text File that has a Tuple
<p>I have a few text files that I created in a separate script, but I am at a loss on how to arrange the text file in the manner that I want.</p>

<p>The text file has three columns:</p>

<p>X, Y, [Z1, Z2, Z3, ...]</p>

<p>Where the X/Y/Z values are arbitrary numbers. </p>

<p>There are several lines in this file, and the Z-lists are of varying lengths. What I would like is for the Z-lists to be separated so that there is only one Z value in each line, but the X/Y values would repeat based on how many elements are in the Z list.</p>

<p>For example, the first two lines of the text file are:</p>

<pre><code>    2306 3481 [2, -3, 82.6, 0.2]
    2336 3408 [9, 0]
</code></pre>

<p>I would like for the two lines to become:</p>

<pre><code>    2306 3481 2
    2306 3481 -3
    2306 3481 82.6
    2306 3481 0.2
    2336 3408 9
    2336 3408 0
</code></pre>
