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.gu...@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@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* _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers