MySQL怎样存储IP地址 - cn三少 - 博客园 https://www.cnblogs.com/cnsanshao/p/3326648.html

 

# coding: utf-8

import socket
import struct


def IpToInt(ipStr):
    return socket.ntohl(struct.unpack('I', socket.inet_aton(ipStr))[0])


def IntToIp(ipInt):
   return socket.inet_ntoa(struct.pack('I', socket.htonl(ipInt)))

 

相关文章:

  • 2022-01-15
  • 2021-06-12
  • 2021-12-13
  • 2021-08-28
  • 2022-12-23
  • 2021-10-22
  • 2021-05-27
猜你喜欢
  • 2021-05-26
  • 2022-12-23
  • 2021-12-29
  • 2022-02-20
相关资源
相似解决方案