r0g <aioe....@technicalbloke.com> writes: > def inet2ip(n): > p = (n/16777216) > q = ((n-(p*16777216))/65536) > r = ((n-((p*16777216)+(q*65536)))/256) > s = ((n-((p*16777216)+(q*65536)+(r*256)))) > return str(p)+"."+str(q)+"."+str(r)+"."+str(s)
from struct import pack def inet2ip(n): xs = pack('L',n) return '.'.join(str(ord(x)) for x in xs) -- http://mail.python.org/mailman/listinfo/python-list