featList = [example[i] for example in dataSet]
classList = [example[-1] for example in dataSet]
将dataSet中的数据先按行依次放入example中,然后取得example中的example[i]元素,放入列表featList中
>>> dataSet
[[1, 1, 'yes'], [1, 1, 'yes'], [1, 0, 'no'], [0, 1, 'no'], [0, 1, 'no']]
>>> i = 0
>>> featList = [example[i] for example in dataSet]
>>> featList
[1, 1, 1, 0, 0]
>>> i = 0
>>> classList = [example[-1] for example in dataSet]
>>> classList
['yes', 'yes', 'no', 'no', 'no']