http://www.artima.com/forums/flat.jsp?forum=181&thread=113874
This worked on my machine (win xp):
socket.getaddrinfo(socket.gethostname(), None)[0][4][0]
On 8/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
hello list
is there in python an independent from the system way to
obtain the IP
i am playng around
<code>
import sys
import os
ipconfname={'nt':'ipconfig', 'posix':'ifconfig'}
ipstr = os.popen (ipconfname[os.name] ).read()
#print ipstr
</code>
but i found out that answer depends on os.name ...
in this case i have to use a different parser for each
system ... so is there another way to retrieve the IP?
regards,
e.
-----------------------------
http://www.atol.bg - Намери бившите си съученици и стари приятели!
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor