ip 193 219 60 33 ip split 193 219 60 33 map lambda bin int rjust 193 2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
>>> ip='193.219.60.33'
>>> ip.split('.')
['193', '219', '60', '33']
>>> map(lambda x: bin(int(x))[2:].rjust(8,'0'), ['193', '219', '60', '33'])
['11000001', '11011011', '00111100', '00100001']
>>> ''.join(['11000001', '11011011', '00111100', '00100001'])
'11000001110110110011110000100001'
>>> int('11000001110110110011110000100001', 2)
3252370465L
>>>