quick data processing with python?
<p>I have a file in the following format:</p>

<pre><code> [s1,s2,s3,s4,...] SOME_TEXT
 (per line)
</code></pre>

<p>For example:</p>

<pre><code> [dog,cat,monkey] 1,2,3
 [a,b,c,d,e,f] 13,4,6
</code></pre>

<p>the brackets are included.</p>

<p>let's say I have another field like this, which contains two lines:</p>

<pre><code> [banana,cat2,monkey2] 1,2,3
 [a2,b2,c2,d,e,f] 13,4,6
</code></pre>

<p>I want to take two files of this form and align them the following way:</p>

<pre><code> [dog^banana,cat^cat2,monkey^monkey2] 1,2,3
 [a^a2,b^b2,c^c2,d^d2,e^e2,f^f2] 13,4,6
</code></pre>

<p>while making sure that "SOME TEXT" in corresponding lines (such as 1,2,3 and 13,4,6) is the same and that the number of elements in the brackets in each corresponding line is the same. What would be a quick compact way to do it?</p>

<p>Thanks.</p>
