source: n4d-dnsmasq/trunk/fuentes/restadorip.py @ 196

Last change on this file since 196 was 196, checked in by hectorgh, 5 years ago

adding files

File size: 296 bytes
Line 
1import sys
2a = sys.argv[1]
3b = sys.argv[2]
4list_a = a.split('.')
5list_a.reverse()
6list_b = b.split('.')
7list_b.reverse()
8total = 0
9for i in range(len(list_a)):
10        if i > 0 :
11                total += (int(list_b[i]) - int(list_a[i])) * (256 ** i)
12        else:
13                total += int(list_b[i]) - int(list_a[i]) + 1
14print total
Note: See TracBrowser for help on using the repository browser.