如下所示: # -*- coding: utf-8 -*- # @ author hulei 2016-5-3 from numpy import * import operator from os import listdir import sys reload(sys) sys.setdefaultencoding('utf8') # x,y=getDataSet_dz('iris.data.txt',4) def getDataSet(filename,numberOfFeature): #将数据集读入内存 fr = open(filename) numberOfLines =