求助新帖子 关于 split函数 出现语法错误 不知道怎么解决


from numpy import * import operator from os import listdir for i in range(m): fileNameStr = trainingFileList[i] fileStr = fileNameStr.split('.')[0] classNumStr = int(fileStr,split('_')[0]) hwLabels.append(classNumStr) trainingMat[i,:] = kNN.img2vector('trainingDigits/%s' % fileNameStr)

Traceback (most recent call last): File "<pyshell#24>", line 4, in <module> classNumStr = int(fileStr,split('_')[0]) TypeError: split() missing 1 required positional argument: 'indices_or_sections'

添加一条新回复
登录 或者 注册 后发表回复