How to get Network Interface Card names in Python?

后端 未结 9 1839
灰色年华
灰色年华 2020-12-06 09:36

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

9条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 10:11

    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.

提交回复
热议问题