Created
November 18, 2012 23:27
-
-
Save jarek-przygodzki/4108083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket, struct | |
def inet_ntoa(address): | |
# !: big-endian; i:int; I:unsigned int; | |
packed_value = struct.pack('!I', address) | |
return socket.inet_ntoa(packed_value) | |
assert inet_ntoa(2130706433) == '127.0.0.1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment