python ValueError: operands could not be broadcast together with shapes (0,) (123,)

本人碰到的问题发生的原因是本人把list类型和numpy的ndarray类型相加了

def f():

      .....

     return x

a = []

for i in range(4):

      b = f()

      a += b

运行后报错ValueError: operands could not be broadcast together with shapes (0,) (123,) 

原因是:a是列表类型,b是numpy.ndarray类型,两者不能用操作符+

你可能感兴趣的:(python,python)