tags:

views:

38

answers:

2

Hi there! I am totally new to python programming so please be patient with me.

Is there anyway to get the names of the NIC cards in the machine etc. eth0, lo? If so how do you do it?

I have researched but so far I have only found codes to get IP addresses and MAC addresses only such as import socket socket.gethostbyname(socket.gethostname()).

Advice on the codes would really be appreciated thanks!

A: 

I don't think there's anything in the standard library to query these names.

If I needed these names on a Linux system I would parse the output of ifconfig or the contents of /proc/net/dev. Look at this blog entry for a similar problem.

Arlaharen
What about for windows? Is there a way like this too?
JavaNoob
Windows is not my strong side. Perhaps some of the information provided by `ipconfig /all` is suitable?
Arlaharen
A: 

I found the solution here

stan
what about for windows?
JavaNoob