Created
June 6, 2013 01:25
-
-
Save nad2000/5718669 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
def straddr2int(addr): | |
""" | |
converts IPv4 address inot an integer | |
>>> str2int('192.168.129.43') | |
3232268587 | |
""" | |
return reduce( lambda a,b: a<<8|b, map(int,addr.split('.')) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment