Function Name
inet_ntoa(ip_address)
Parameters
ip_address – The address in 32-bit packed format which is to be converted
Return Value
Returns the IP address in dotted quad-string format.
Function Overview
Converts an IP address, which is in 32-bit packed format to the popular human readable dotted-quad string format.
Example
import socket
import struct
IPLong = 168496141
IP32Bit = struct.pack('!I', IPLong)
IPQuad = socket.inet_ntoa(IP32Bit)
print(IPQuad)The Python example above first converts an IP address in decimal format to 32 bit packed address.
Using the function inet_ntoa it converts the 32 bit packed address into the dotted-quad string format.
Output
10.11.12.13