LVector[l/6] +=1 为何报错?
代码如下:
for oneRow in range(rowcnt):
for oneCol in range(colcnt):
r, g, b = ndarr[oneRow][oneCol]
h, s, v = colorsys.rgb_to_hsv(r/255, g/255, b/255)
h = h * 360
l = self._hsv2L(h, s, v)
LVector[l/6] +=1
lsum =sum(LVector)
result = [v * 1.0/lsum for v in LVector]
代码报错如下:
LVector[l/6] +=1
TypeError: list indices must be integers or slices, not float