2015-04-22から1日間の記事一覧
import struct print '%08x' % struct.unpack('<L', struct.pack('>f', <数値>))[0] 例: >>> print '%08x' % struct.unpack('<L',struct.pack('>f',1.0))[0]0000803f おまけ: 逆に、floatのバイト列の文字列から、10進数のfloatに戻す場合 print '%f' % struct.unpack('>f',struct.pack('<L',int(<文字列>,16)))[</l',int(<文字列></l',struct.pack('></l',>…