get the IP address of a host

Nick Coghlan ncoghlan at iinet.net.au
Thu Jan 6 08:51:23 EST 2005


J Berends wrote:
> Lee Harr wrote:
>> Basically, it scrapes the output from ifconfig for the
>> actual address assigned to the interface. Works perfectly
>> on FreeBSD and Linux (given the correct configuration).
> 
> 
> Nice way, have to device something for windows than.

Use the same approach, but scrape the output of ipconfig instead. Use subprocess 
to run the command in Python 2.4, or work something out with one of the popen 
variants for earlier versions.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list