c4_part1 + = self.imageGrayscalePixels [xCoordinate,yCoordinate] TypeError:+ =不支持的操作数类型:“ int”和“ tuple”
答案 0 :(得分:0)
self.imageGrayscalePixels[xCoordinate, yCoordinate]
这将返回一个小礼堂。您不能将其添加到int
中。您需要先从元组中提取值,然后再将其添加到c4_part1
。
示例:
x = self.imageGrayscalePixels[xCoordinate, yCoordinate]
c4_part1 += x[0] # 0 -> index of the value