You could do it like this:
a1 = []
a2 = []
a3 = []
a4 = []
with open('f1.txt') as f:
for line in f:
data = line.split()
a1.append(int(data[0]))
a2.append(int(data[1]))
a3.append(int(data[2]))
a4.append(int(data[3]))
So first of all, we use the with statement to open the file. This makes sure that the file is automatically closed even when errors appear. It’s just nicer that way. While the file is open f will be the file handle.
Now, Python allows us to iterate over the lines of a file simply by iterating over the file handle. So for line in f will iterate over all lines automatically. There is no need to call readlines() first, and certainly no need to do lines[0:len(lines)] which essentially only creates a copy of the list—you could just iterate over lines too.
Now inside of the loop, we take the line, and split it by whitespace—without arguments str.split will always do that. str.split returns a list, so we store that in an extra variable. Next we append each column to the correct list. And as you want the values as numbers, we convert them to integers.
The str.strip you mentioned basically takes off any leading or trailing whitespace of the string. As we are using str.split without arguments, extra whitespace will be removed too, so we don’t really need that.
Finally, having four separate lists stored in separate variables is a bit annoying to maintain. You could simply create a list of lists instead:
a = [[], [], [], []] # A list with four empty lists
And then, inside of the loop, you can just append data[i] to a[i]:
for i, value in enumerate(line.split()):
a[i].append(int(value))
When iterating over enumerate, you will not only get the value (which you would get when iterating just over the list), but also the index. So using this, we get the index of each element within the splitted line and can automatically append it to the correct sublist of a.