Merge multiple lists horizontally in python
<p>I have two different lists like below</p>

<pre><code>A = [(Apple, Mango)]
B = [Grapes]
</code></pre>

<p>Now I would like to get a merged list as follows</p>

<pre><code>C = [(Apple,Mango,Grapes)]
</code></pre>

<p>Is there any predefined functions available in python to get above merged list.</p>

<p>Note: Already used zip method which is returning the result as different result</p>

<pre><code>C = [(Apple,Mango),(Grapes)]
</code></pre>

<p>The snippet of code which returned above result is this</p>

<pre><code>A = [('Apple','Mango')]
B = ['Grapes']

C = zip(A,B)

print C
</code></pre>

<p>If A and B is list of tuples then you can be use following recursive function</p>

<p><strong>Input something like this</strong></p>

<pre><code>A = [('Apple', 'Mango'), ('Mango1')]
B = [('Grapes', 'Banana'), ('Apple1')]
</code></pre>

<p><strong>Recursive function</strong> </p>

<pre><code>def recursive_fun(c, temp_list):
    for i in c:
        if type(i) is tuple:
            recursive_fun(list(i), temp_list)
        else :
            temp_list.append(i)
    return temp_list
</code></pre>

<p><strong>Output</strong></p>

<pre><code>[tuple(recursive_fun(A, [])+ recursive_fun(B, []))]
</code></pre>

<p><strong>Final output</strong></p>

<pre><code>[('Apple', 'Mango', 'Mango1', 'Grapes', 'Banana', 'Apple1')]
</code></pre>

python