convert all rows to columns and columns to rows in Arrays
<p>I'm trying to create this program (in python) that converts all rows to columns and columns to rows.<p> To be more specific,  the first input are 2 numbers. <code>N</code> and <code>M</code>. <code>N</code> - total rows,<code>M</code> total columns. I've used <code>b=map(int, raw_input().split())</code>. and then based on <code>b[0]</code>, Each of the next <code>N</code> lines will contain <code>M</code> space separated integers. For example:</p>

<pre><code>Input:

3 5
13 4 8 14 1
9 6 3 7 21
5 12 17 9 3  
</code></pre>

<p>Now the program will store it in a 2D array:</p>

<pre><code>arr=[[13, 4, 8, 14, 1], [9, 6, 3, 7, 21], [5, 12, 17, 9, 3]]
</code></pre>

<p>What's required for the output is to print M lines each containing N space separated integers. For example:</p>

<pre><code>Output:

13 9 5
4 6 12
8 3 17
14 7 9
1 21 3
</code></pre>

<p><p>
This is what I've tried so far:</p>

<pre><code> #Getting N and M from input
 NM=map(int, raw_input().split())
 arr=[]

 for i in xrange(NM[0]):
     c=map(int, raw_input().split())
     arr.append(c)
</code></pre>

<p>I've created a 2D array and got the values from input but I don't know the rest. Let me make this clear that I'm definitely NOT asking for code. Just exactly what to do to convert rows to columns and in reverse.<p>
Thanks in advance!</p>