我试图用struct.pack将一个短的(2个字节)和一个长的(8个字节)的字节数组编码成一个字节数组,输出的大小为16而不是10:print(len(struct.pack('Hq',1,2))) #show 16 and not 10
注:len(struct.pack('H',1))正确返回2,len(struct.
我正在使用一个不是我写的NDVI脚本,我正在尝试让它运行。它的问题是旧的类型错误:不能隐式地将字节对象转换为str。separate images per band # Red = band 1 and NIR = band 2red_band = dataset.GetRasterBand(1)
# Retrieve the