【code】
import numpy as np nparr = np.array([[1 ,2, 3, 4]]) np_int32 = nparr[0][0] # np_int=1 py_int = 1234 #打印类型 print("type(py_int32)="+str(type(py_int32))) print("type(np_int)="+str(type(np_int))) #numpy 的int32 转 int64 np_int64=np.int64(np_int ) print("type(np_int64)="+str(type(np_int64)))
【result】
type(py_int)=<class ‘int‘> type(np_int)=<class ‘numpy.int32‘> type(np_int64)=<class ‘numpy.int64‘>