[BangPypers] mac IP

Santosh Rajan santrajan at gmail.com
Thu Apr 14 14:58:37 CEST 2011


I think the solution below will give you all the ip addresses including
127.0.0.1. In any case this is not an easy one to solve. Depends on a lot of
factors. You might want to revisit your original question on why you want
the ip address? and which ip address (local or inet)?, and investigate
wether you really need the ip address to solve the problem?

On Thu, Apr 14, 2011 at 5:46 PM, Sudharshan Gupta <
sudharshan.gupta at in.fiorano.com> wrote:

> Hi nitin,
>
> I think this works
> import socket
> socket.gethostbyname(socket.gethostname())
> socket.gethostbyname_ex(socket.gethostname())
>
>
>
>
>
> Nitin Kumar wrote:
>
>> Hi All,
>>
>> Is anyone aware how to fetch mac machine IP using python?
>>
>>
>>
>
>
> --
> Thanks & Regards
> Sudharshan
>
>
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
http://about.me/santosh.rajan

“The *young man* knows the rules but the *old man* knows the
exceptions”. *Oliver
Wendell Holmes*


More information about the BangPypers mailing list