Move to next column after specific number of lines in python
<p>If I have a data set that runs:<br>
1<br>
2<br>
3<br>
4<br>
5<br>
6<br>
from a python output, and i want:<br>
1  4<br>
2  5<br>
3  6<br>
basically after a specific number of lines, I would like to move the output into the next column, can this be done in Python?  </p>

<p>This is what I currently have:  </p>

<p><code>aa=[]
    for index, line in enumerate(open("random.txt")):
      if index &lt;= 0: continue
      else:
        holder = line.split("\t")
        dataEle = [ val[6] , val[7] , val[9] , val[10] ]
        dataL.append( dataEle )</code></p>

<pre><code>for ee in dataL:  
  for line in ee:  
    print line  
</code></pre>

<pre><code>lines = ['1','2','3','4','5','6']

print(lines[:round(len(lines)/2)])

for i in range(round(len(lines)/2)):
    print(lines[i] + lines[i + 3], sep=' ')  
## 1 4 
## 2 5 
## 3 6
</code></pre>

<p>Anyways you are going to keep your file data in list. So I see that you are able to do it by your own. It is the first idea which came into my mind and I think there are some way to optimize this code. But still I hope you caught the main plot. Good Luck!</p>

python file row multiple-columns lines