def loadImages(dirName):
    from os import listdir
    hwLabels = []
    trainingFileList = listDirInMac(dirName)  # load the training set
    m = len(trainingFileList)
    trainingMat = zeros((m, 1024))
    for i in range(m):
        fileNameStr = trainingFileList[i]
        fileStr = fileNameStr.split('.')[0]  # take off .txt
        classNumStr = int(fileStr.split('_')[0])
        if classNumStr == 9:
            hwLabels.append(-1)
        else:
            hwLabels.append(1)
        trainingMat[i, :] = img2vector((dirName, fileNameStr) % '%s/%s')
    return trainingMat, hwLabels
dataset/ETHPy150Open Yaoshicn/decaptcha/svmMLiA.py/loadImages/swapped operands of `%`