Use python to convert between IP addresses and numbers

xiaoxiao2021-03-06  108

Colleagues want to convert the IP addresses indicated in the database into standard digital IPs. To find a tool, I said that I can write a script with Python. It should be very simple, the result has the following code: >>> Import Socket >>> Import Struct >>> Socket.inet_NTOA (Struct.Pack ('i', socket.htonl (-591250144)) '220.194. 61.32 '>>> Socket.ntohl (Struct.unpack ("I", socket.inet_aton (' 220.194.61.32 ')) [0]) - 591250144 Simple, Python is really a good stuff. Good helper work!

转载请注明原文地址:https://www.9cbs.com/read-101445.html

New Post(0)