-1

在我的项目中,我需要获得所有网络设备的列表,如 WiFi、蓝牙、以太网等等……有没有一种Pythonic的方法来获得它?

非常感谢!

4

1 回答 1

3

看看网吧

>>> netifaces.interfaces()
['lo', 'eth0']
>>> netifaces.ifaddresses('eth0')
{17: [{'broadcast': 'ff:ff:ff:ff:ff:ff', 'addr': '00:25:11:ad:1b:dd'}], 2: [{'broadcast' : '192.168.8.255', 'netmask': '255.255.255.0', 'addr': '192.168.8.135'}], 10: [{'netmask': 'ffff:ffff:ffff:ffff::', '地址': 'fe80::225:11ff:fead:1bdd%eth0'}]}
于 2013-10-02T09:30:28.717 回答