restoring list from unified_diff output
<p>I need to generate the diff between two arrays of strings:</p>

<pre><code>a=['1','2']
b=['1','2','3']
</code></pre>

<p>To achieve this I'm using the difflib library in Python (2.6):</p>

<pre><code>c=difflib.unified_diff(a,b)
</code></pre>

<p>and I save the content of</p>

<pre><code>d=list(c)
</code></pre>

<p>which is something like:</p>

<pre><code>['---  \n', '+++  \n', '@@ -1,2 +1,3 @@\n', ' 1', ' 2', '+3']
</code></pre>

<p>How can I build the second array from the first using the output of the unified_diff function? </p>

<p>The behavior that I'm looking for is something like:</p>

<pre><code>&gt;&gt;&gt; merge(a,d)
&gt;&gt;&gt; ['1','2','3']
</code></pre>

<p>P.S. the array can have duplicate entries and the order in which each entry appears is important for my application. Moreover, from one iteration to another there could be changes both in the middle/begin of the array, as well as new entries added at the end.</p>
