def read_attributes(filename):
with open(filename, 'r') as f:
header = f.readline().strip()
attributes = [attr.strip() for attr in header.split(",")]
return attributes
def read_data(filename, attributes):
with open(filename) as f:
lines = [line.strip() for line in f.readlines()]
del lines[0] # header :)
data = []
for line in lines:
data.append(dict(zip(attributes, [datum.strip() for datum in line.split(",")])))
return data