I have a text file which contains a table comprised of numbers e.g:
5 10 6 6 20 1 7 30 4 8 40 3 9 23 1 4 13 6
5 10 6
6 20 1
7 30 4
8 40 3
9 23 1
4 13 6
You can use a zip function with a list comprehension :
zip
with open('ex.txt') as f: print zip(*[line.split() for line in f])[1]
result :
('10', '20', '30', '40', '23', '13')