source:
n4d-dnsmasq/trunk/fuentes/restadorip.py
@
196
Last change on this file since 196 was 196, checked in by , 5 years ago | |
---|---|
File size: 296 bytes |
Line | |
---|---|
1 | import sys |
2 | a = sys.argv[1] |
3 | b = sys.argv[2] |
4 | list_a = a.split('.') |
5 | list_a.reverse() |
6 | list_b = b.split('.') |
7 | list_b.reverse() |
8 | total = 0 |
9 | for 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 |
14 | print total |
Note: See TracBrowser
for help on using the repository browser.