how to convert ip address to dot notation

Eddie Corns eddie at holyrood.ed.ac.uk
Mon Aug 4 13:06:45 EDT 2003


Ruslan Spivak <alienoid at is.lg.ua> writes:

>Hello, python users!

>I have ip addresses in my mysql db in int value - 3232261127, for example.
>How can i convert that to usual dot notation like 192.168.100.7?

mysql itself can do this, use inet_ntoa() eg

select inet_ntoa (...) from ...

or alternatively use inet_aton() inside the query eg:

select ... from ... where x = inet_aton ('192.168.100.7')

Eddie




More information about the Python-list mailing list