我需要有关此错误的帮助:"属性错误:' builtin_function_or_method'对象没有属性' split' 2""
import operator
from numpy import *
def loadDataSet(filename):
dataMat= []; labelMat= []
fr = open(filename)
for line in fr.readlines():
lineArr = line.strip.split('\t')
dataMat.append([float(lineArr[0]), float(lineArr[1])])
labelMat.append(float(lineArr[2]))
return dataMat, labelMat
def selectJrand(i, m):
j=i
while (j == i):
j=int(random.uniform(0, m))
return j
def clipAlpha(aj, H, L):
if aj > H:
aj=H
if L > aj:
aj = L
return aj
该错误如下:
dataArr, labelArr = svmMLiA.loadDataSet('testSet.txt')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\python2.7.12\lib\svmMLiA.py", line 5, in loadDataSet
lineArr = line.strip.split('\t')
AttributeError: 'builtin_function_or_method' object has no attribute 'split'
答案 0 :(得分:1)
正如错误所述,<xs:assert id="plausibility-file-and-record-timezones"
test="timezone-from-dateTime(Record/@issuance-date) = timezone-from-dateTime(REcords@content-date)"/>
是您需要调用的方法,就像strip
一样。
split
答案 1 :(得分:1)