Hi all,
I am trying convert IP addresses form Decimal format [Like 192.168.12.13] to HEX format [c0 a8 9d 80].
For Example the IP "192.168.157.128" is equivalent to "c0 a8 9d 80" in HEX.
How to do that.??

One way.

>>> ip = "192.168.157.128"
>>> ip = ip.split('.')
>>> ' '.join((hex(int(i))[2:] for i in ip))
'c0 a8 9d 80'
>>>
commented: It helped me alot... +3

Thanks a lot..buddy...!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.