gpt4 book ai didi

python - 使用 Windows 在 python 中获取友好的设备名称

转载 作者:可可西里 更新时间:2023-11-01 09:20:02 25 4
gpt4 key购买 nike

我想使用设备 GUID 获取网络接口(interface)名称。

我有一个使用"ipconfig/all" 解析接口(interface)名称的答案

但是 "ipconfig/all" 非常复杂...

所以我想成为Getting friendly device names in python

但这只显示 usb 驱动程序..

我可以找到GUID(实际上我不知道)后面的代码:

import netifaces as ni
x=ni.interfaces()
print x

这个节目是这样的['{CDC97813-CC28-4260-BA1E-F0CE3081DEC7}']

我想转换友好的设备名称,如“本地连接”

最佳答案

而不是 ipconfig/all 这确实非常复杂,考虑这些更简单,就输出而言,命令:

>netsh interface show interface

Admin State State Type Interface Name
-------------------------------------------------------------------------
Enabled Connected Dedicated Wireless Network Connection
Enabled Disconnected Dedicated Local Area Connection

>netsh interface ip show interfaces

Idx Met MTU State Name
--- ---------- ---------- ------------ ---------------------------
13 25 1500 connected Wireless Network Connection
12 5 1500 disconnected Local Area Connection

这些对于解析接口(interface)名称来说应该是微不足道的

关于python - 使用 Windows 在 python 中获取友好的设备名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30020492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com