我运行了以下被认为相同的脚本,但输出完全不同,谁能解释为什么?
我首先导入了必要的模块:
from ctypes import *
import numpy as np
代码1:
AOVoltage = np.linspace(-1, 1, 2200)
AOVoltage = AOVoltage.ctypes.data_as(POINTER(c_double))
print AOVoltage.contents
c_double(1.821347161578237e-284)
代码2:
a = np.linspace(-1, 1, 2200)
AOVoltage = a.ctypes.data_as(POINTER(c_double))
print AOVoltage.contents
c_double(-1.0)
代码3:
AOVoltage = (np.linspace(-1, 1, 2200)).ctypes.data_as(POINTER(c_double))
print AOVoltage.contents
c_double(1.821347161578237e-284)