文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Python实现64位整型主机字节顺序和网络字节顺序的转换

Python实现64位整型主机字节顺序和网络字节顺序的转换

时间:2010-06-24  来源:zhcn381

使用struct,相当轻松
import struct
def htonll(Val):     strNative = struct.pack('Q', Val)     BEVal = struct.unpack('!Q', strNative)[0]     return BEVal
def ntohll(Val):     strBE = struct.pack('!Q', Val)     NativeVal = struct.unpack('Q', strBE)[0]     return NativeVal

相关阅读 更多 +
排行榜 更多 +
西安交大通

西安交大通

生活实用 下载
长江云通

长江云通

生活实用 下载
translatez

translatez

生活实用 下载