a_string = a_string.rstrip(" ")
mylist = [] # Assuming that you have loaded data into a lines variable. for line in lines: mylist.append(line.strip().split(' ')