Question: In python IDLE, I want to create 3 lists from 3 columns in the text file which contains the following data set:

```
1.23 2.01 3.15
52.02 958.02 52.02
15.23 59.45 65.78
75.01 25.26 55.26
65.10 98.23 58.45

```

I want the output like this:

```
a = [1.23, 52.02, 15.23, 75.01, 65.10]
b = [2.01, 958.02, 59.45, 25.26, 98.23]
c = [3.15, 52.02, 65.78, 55.26, 58.45]

```

Answer: 
Firstly you could split them into a table of all on one line with a list comprehension

```
[line.split(' ') for line in open('s69498849.txt','r').read().split('\n')]

[['1.23', '2.01', '3.15'], ['52.02', '958.02', '52.02'], ['15.23', '59.45', '65.78'], ['75.01', '25.26', '55.26'], ['65.10', '98.23', '58.45']]

```

Then, just flatten the list

```
[i for o in [line.split(' ') for line in open('filename.txt','r').read().split('\n')] for i in o]

['1.23', '2.01', '3.15', '52.02', '958.02', '52.02', '15.23', '59.45', '65.78', '75.01', '25.26', '55.26', '65.10', '98.23', '58.45']

```

And then use slices to get them

```
data[::1]

['1.23', '52.02', '15.23', '75.01', '65.10']

```

All together now;

```
data=[i for o in [line.split(' ') for line in open('filename.txt','r').read().split('\n')] for i in o]
a=data[::1]
b=data[::2]
c=data[::3]

```

Note: if you want to control or do something to all of them, you could change

`line.split(' ')` to `[line.split(' ')[0],line.split(' ')[1],line.split(' ')[2]]`
and then you could do whaterver to them, like converting them to integers with int()
First, you need to open the file:

```
file = open("file name")

```

then make lists for each line using and split each one by the white space:

```
line1 = file[0].split()
line2 = file[1].split()
line3 = file[2].split()
line4 = file[3].split()
line5 = file[4].split()
lines = [line1, line2, line3, line4, line5]

```

and make your list using the first element in each line:

```
a = []
for i in lines:
    a.append(i[0])

b = []
for i in lines:
    a.append(i[1])

c = []
for i in lines:
    a.append(i[2])

```

and done!