def ipnumber(ip): ip=ip.rstrip().split('.') ipn=0 while ip: ipn=(ipn<<8)+int(ip.pop(0)) return ipn def ipstring(ip): ips='' for i in range(4): ip,n=divmod(ip,256) ips = str(n)+'.'+ips return ips[:-1] ## take out extra point >>> ipnumber('22.214.171.124') 3555336315L >>> ipstring(_) '126.96.36.199' >>>
Edited by pyTony: empty line
Are you able to help answer this sponsored question?
Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.