Skip to content

Instantly share code, notes, and snippets.

@chrisgilmerproj
Created September 4, 2012 23:18
Show Gist options
  • Save chrisgilmerproj/3627922 to your computer and use it in GitHub Desktop.
Save chrisgilmerproj/3627922 to your computer and use it in GitHub Desktop.
ip2hex
def ip2hex(ip):
return ":".join(map(lambda x: hex(int(x))[2:].zfill(2), ip.split(".")))
def ip2hex(ip):
return ":".join(map(lambda x: "%02x" % int(x), ip.split(".")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment