色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

用python轉換浮點數為16進制怎么寫

洪振霞2年前11瀏覽0評論

用python轉換浮點數為16進制怎么寫?

# -*- coding: utf8 -*-import ctypesdef h2f(s): cp = ctypes.pointer(ctypes.c_longlong(s)

) fp = ctypes.cast(cp, ctypes.POINTER(ctypes.c_double)

) return fp.contents.valuedef f2h(s): fp = ctypes.pointer(ctypes.c_double(s)

) cp = ctypes.cast(fp, ctypes.POINTER(ctypes.c_longlong)

) return hex(cp.contents.value)print(f2h(34.4536)

)print(h2f(0x40413a0f9096bb99))