把向量放到一个list中,用for i in list进行遍历 循环数字时为for i in range(num)
import numpy as np # 列向量乘行向量 x1 = np.array([[1,2]]).T x2 = np.array([[1,3]]).T x = [x1, x2] res = 0 for i in x: res += i * i.T; print(res)