TypeError: Field elements must be 2- or 3-tuples, got ‘4‘

错误案例

import numpy as np
a = np.array([1, 2, 3], [4, 5, 6])

报错提示

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_52444/3433848368.py in <module>
      1 import numpy as np
----> 2 a = np.array([1, 2, 3], [4, 5, 6])

TypeError: Field elements must be 2- or 3-tuples, got '4'

正确代码

import numpy as np
# a = np.array([1, 2, 3], [4, 5, 6])  # 错误
a = np.array([[1, 2, 3], [4, 5, 6]])  # 正确

你可能感兴趣的:(#,TypeError,python,数组,测试,numpy)