I want to read an arff file and separate the attribute and data into different list. The file is [here](https://github.com/lpfgarcia/ucipp/blob/master/uci/balloons-adult-stretch.arff). I tried the following code

```
from itertools import dropwhile
attributes = []
with open('balloons.arff', 'r') as f:
    for l in f.readlines():                                     ##1
        items = l.split(' ')                                    ##2
        if items[0] == '@attribute':                            ##3
            attributes.append(items[1])                         ##4
    data = dropwhile(lambda _line: "@data" not in _line, f)     ##5
    next(data,"")                                               ##6
    for line in data:                                           ##7
            print(line.strip())                                 ##8
    print(attributes)                                           ##9

```

When I run this code, I am getting only the list of attributes but when I comment line numbers ##1 to ##4 (first for loop), the program gives the data part correctly. I have very large files, an efficient solution will be appreciated.