[Tutor] [tutor] ipconfig

emilia12 at mail.bg emilia12 at mail.bg
Thu Aug 10 15:47:43 CEST 2006


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 - Намери бившите си съученици и стари приятели!



More information about the Tutor mailing list