通过range构造数组
trainingSet = range(50);
在执行以下操作时del(trainingSet[randIndex])
报错:TypeError: 'range' object doesn't support item deletion
原因是python3中range不返回数组对象,而是返回range对象
解决办法将<pre name="code" class="python">trainingSet = range(50);替换为trainingSet = list(range(50));